I. Operations for time addition and subtraction
Subtract a certain number of days from the interval
Function date1 ()
Dim newtime as datetime
Newtime = datetime. Now. Subtract (New timespan (7, 0, 0, 0 ))
Newtime = newtime. Format ("mm/DD/YYYY", datetimeformatinfo)
Response. Write (newtime)
End Function
Use the method of adding negative days minus a certain number of days
Public Function date2 ()
Dim newtime as datetime
Newtime = datetime. Now. adddays (-7)
Dim s as string = newtime
Return s
End Function
Returns the date name string.
Function date3 ()
Dim newtime as datetime = now. adddays (-7)
Response. Write (system. String. Format ("{0: mm/DD/YYYY}", newtime ))
End Function
Function date4 ()
Dim newtime as datetime
Newtime = now. adddays (-7)
Return newtime. tostring ()
End Function
Long time mode
Public Function date5 ()
Dim newtime as datetime
Newtime = now ()
Return newtime. tolongtimestring ()
End Function
Use short time mode
Public Function date6 ()
Dim newtime as datetime
Newtime = now ()
Return newtime. tow.timestring ()
End Function
Use long date mode
Public Function date7 ()
Dim newtime as datetime
Newtime = now ()
Return newtime. tolongdatestring ()
End Function
Use short-day start Mode
Public Function date8 ()
Dim newtime as datetime
Newtime = now ()
Return newtime. tow.datestring ()
End Function
Format date functions
Format to common format
Function date9 ()
Dim newtime as datetime
Newtime = datetime. Now. Subtract (New timespan (7, 0, 0, 0 ))
Return formatdatetime (newtime, 0)
End Function
Format the growth Date Format
Function date10 ()
Dim newtime as datetime
Newtime = datetime. Now. Subtract (New timespan (7, 0, 0, 0 ))
Return formatdatetime (newtime, 1)
End Function
Format to short Date Format
Function date11 ()
Dim newtime as datetime
Newtime = datetime. Now. Subtract (New timespan (7, 0, 0, 0 ))
Return formatdatetime (newtime, 2)
End Function
Format the growth time format
Function date12 ()
Dim newtime as datetime
Newtime = datetime. Now. Subtract (New timespan (7, 0, 0, 0 ))
Return formatdatetime (newtime, 3)
End Function
Format to Short-Time Format
Function date13 ()
Dim newtime as datetime
Newtime = datetime. Now. Subtract (New timespan (7, 0, 0, 0 ))
Return formatdatetime (newtime, 4)
End Function
Displays the year, month, and day of the time separately.
Display date
Function date14 ()
Dim newtime as datetime = now. adddays (-7)
Dim s as string
S = (system. String. Format ("{0: dddd}", newtime ))
Return s
End Function
Returns the day of the week of the date.
Function date15 ()
Dim mydate as datetime
Dim myweekday as integer
Mydate = now. adddays (-5)
Myweekday = weekday (mydate)
Return myweekday
End Function
Returns the month value.
Function date16 ()
Dim mydate as datetime
Dim mymonth as integer
Mydate = now. adddays (-5)
Mymonth = month (mydate)
Return mymonth
End Function
Returns a formatted string.
Function date17 ()
Dim mydate as string
Mydate = format (now (), "YYYY ")
Return mydate
End Function
</SCRIPT>