我有以下VB代码:
Dim value As Date = Date.Now
Dim intHour As Integer
Dim intMinute As Integer
Dim intSecond As Integer
intHour = 17
intMinute = 0
intSecond = 0
Dim newdatetime As DateTime = New Date(value.Year, value.Month, value.Day, intHour, intMinute, intSecond)
If DateTime.Now < newdatetime Then
If value.DayOfWeek = DayOfWeek.Saturday Then
value = value.AddDays(2)
Return value
End If
If value.DayOfWeek = DayOfWeek.Sunday Then
value = value.AddDays(1)
Return value
End If
Return value
ElseIf DateTime.Now > newdatetime Then
Do
value = value.AddDays(1)
Loop While (value.DayOfWeek = DayOfWeek.Saturday) Or (value.DayOfWeek = DayOfWeek.Sunday)
Return value
End If
在ASP CLassic中会怎样?
有人可以帮忙吗?
编辑:
Dim CurrentDate
CurrentDate = Date()
Dim intHour
Dim intMinute
Dim intSecond
intHour = 17
intMinute = 0
intSecond = 0
Dim NewDate
Dim NewDate1
Dim NewDate2
NewDate = DatePart("yyyy", CurrentDate)
NewDate1 = DatePart("m", CurrentDate)
NewDate2 = DatePart("d", CurrentDate)
Dim Dates
Dates = DateSerial(NewDate, NewDate1, NewDate2)
Dim Time
Time = TimeSerial(intHour, intMonth, intSecond)
答案 0 :(得分:1)
年:http://msdn.microsoft.com/en-us/library/fhzx965c%28v=vs.85%29.aspx
月:http://msdn.microsoft.com/en-us/library/0eeeket2%28v=vs.85%29.aspx
每月的一天:http://msdn.microsoft.com/en-us/library/yyhfe92k%28v=vs.85%29.aspx
日期比较:http://msdn.microsoft.com/en-us/library/xhtyw595%28v=vs.85%29.aspx
星期几:http://msdn.microsoft.com/en-us/library/t51x9wtx%28v=vs.85%29.aspx
增加日期:http://msdn.microsoft.com/en-us/library/cb7z8yf9%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/d1wf56tt%28v=VS.85%29.aspx是VBScript / ASP经典的绝佳参考。