一。各种时间加减的运算
用时间间隔的方法减去一定的天数
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
使用加负天数的方法减去一定的天数
Public Function Date2()
Dim NewTime as DateTime
NewTime = DateTime.Now.AddDays(-7)
Dim s as string = NewTime
return s
End Function
返回日期名称字符串
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
使用长时间模式
Public Function Date5()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toLongTimeString()
End Function
使用短时间模式
Public Function Date6()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toShortTimeString()
End Function
使用长日期模式
Public Function Date7()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toLongDateString()
End Function
使用短日起模式
Public Function Date8()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toShortDatestring()
End Function
格式化日期函数
格式化成通用格式
Function Date9()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 0)
End Function
格式化成长日期格式
Function Date10()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 1)
End Function
格式化成短日期格式
Function Date11()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 2)
End Function
格式化成长时间格式
Function Date12()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 3)
End Function
格式化成短时间格式
Function Date13()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 4)
End Function
单独显示时间的年,月,日等部分
显示日期
Function Date14()
Dim NewTime as DateTime = now.addDays(-7)
dim s as string
s = (System.String.Format("{0:dddd}",NewTime))
Return s
End Function
返回日期的一周中的第几天
Function Date15()
Dim MyDate as DateTime
Dim MyWeekDay as Integer
MyDate = Now.AddDays(-5)
MyWeekDay = Weekday(MyDate)
return MyWeekDay
End Function
返回月份值
Function Date16()
Dim MyDate as DateTime
Dim MyMonth as Integer
MyDate = Now.AddDays(-5)
MyMonth = Month(MyDate)
return MyMonth
End Function
返回一个格式化后的字符串
Function Date17()
Dim MyDate as String
MyDate = Format(Now(), "yyyy")
return MyDate
End Function
</script>
用时间间隔的方法减去一定的天数
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
使用加负天数的方法减去一定的天数
Public Function Date2()
Dim NewTime as DateTime
NewTime = DateTime.Now.AddDays(-7)
Dim s as string = NewTime
return s
End Function
返回日期名称字符串
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
使用长时间模式
Public Function Date5()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toLongTimeString()
End Function
使用短时间模式
Public Function Date6()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toShortTimeString()
End Function
使用长日期模式
Public Function Date7()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toLongDateString()
End Function
使用短日起模式
Public Function Date8()
Dim NewTime as DateTime
NewTime = Now()
return newtime.toShortDatestring()
End Function
格式化日期函数
格式化成通用格式
Function Date9()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 0)
End Function
格式化成长日期格式
Function Date10()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 1)
End Function
格式化成短日期格式
Function Date11()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 2)
End Function
格式化成长时间格式
Function Date12()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 3)
End Function
格式化成短时间格式
Function Date13()
Dim NewTime as DateTime
NewTime = DateTime.Now.Subtract( New TimeSpan(7, 0, 0, 0) )
return formatdatetime(NewTime, 4)
End Function
单独显示时间的年,月,日等部分
显示日期
Function Date14()
Dim NewTime as DateTime = now.addDays(-7)
dim s as string
s = (System.String.Format("{0:dddd}",NewTime))
Return s
End Function
返回日期的一周中的第几天
Function Date15()
Dim MyDate as DateTime
Dim MyWeekDay as Integer
MyDate = Now.AddDays(-5)
MyWeekDay = Weekday(MyDate)
return MyWeekDay
End Function
返回月份值
Function Date16()
Dim MyDate as DateTime
Dim MyMonth as Integer
MyDate = Now.AddDays(-5)
MyMonth = Month(MyDate)
return MyMonth
End Function
返回一个格式化后的字符串
Function Date17()
Dim MyDate as String
MyDate = Format(Now(), "yyyy")
return MyDate
End Function
</script>