The date and time function example of the ASP can use the date and time function to get the date and time of various formats.
function
grammar
Description
Example
NOW
NOW () gets the current date and time of DIM MyVar myvar = now 'MyVar contains current date and time.
Date
Date () gets the system's current date DIM MyDate mydate = Date 'mydate contains the current system date.
Time
Time () gets the current time DIM MyTime MyTime = Time 'returns the current system time.
Year
Year (date) acquired a given date DIM MyDate, MyyEarmyDate = #ocTober 19, 1962 # 'assigned a day. Myyear = year (mydate) 'myyear contains 1962.
Month
Month (Date) Number DIM MyVAR = MONTH (NOW) 'MyVar contains the number corresponding to the current month.
DAY
Day (date) gets a given date is a few Dim myday myday = days ("October 19, 1962") 'myday contains 19.
Hour
Hour (TIME) gets a given time is the first few hours DIM MyTime, myHOURMYTIME = now myHour = Hour (MyTime) 'MyHOUR contains values that represent the current time.
Minute
Minute (TIME) gets a given time is the first few minutes Dim Myvarmyvar = Minute (now)
SECOND
SECOND (TIME) Give time is the first second dim mysecmysec = second (now) 'mysec contains numbers representing the current second.
Weekday
Weekday (Date) obtained a given date is an integer of the week. , MyDate represents Friday
Datediff
Datediff ("var", var1, var2) var: date or time interval, there is the following parameters: YYYY Month D Japanese WW Week h hours s second var 12: first date or time var2: second date or time Datediff ("D", Date (), # 1/1/2005 #) 'to return to 2005 New Year's Day Datediff ("H", Date (), # 1 after calculating DateDiff ("D", DATE (), # 1/1/2005 #)' / 1/2005 #) 'Return from 2005 New Year's Day Datediff ("D", # 1/1/2003 #, # 1/1/2005 #)' Returns the number of days between two dates
Dateadd
Datediff ("VAR", VAR1, VAR2) VAR: Date or Time Listance Factor: Var1: Date or Time Spacer Dues VAR2: Date or Time Based on Two Date or Time Makes the addition to the following example No. 95 January 31 Previous month: newdate = dateadd ("m", 1, "31-jan-95") In this example, DateAdd returned to February 28, 95, not on February 31, 95. If DATE is January 31, 96, it returns to February 29, 96, because 1996 is a leap year. If the calculated date is 100 years ago, an error will occur.
FormatDateTimeFormator (Date, VBshDate) is transformed into short-term format from ATDATDATETIME (Date (), vblongdate "" displayed in long date format
FormatorTime (date, vblongdate) is transformed into long-term format
FormatorTime (Date, VBShortTime) is transformed into short-time formatDatetime (date, vblongtime) transformation into long-time format