TA的每日心情 | 开心 2016-2-27 08:48 |
---|
签到天数: 2 天 连续签到: 1 天 [LV.1]测试小兵
|
请参考下面的代码
'The following is the dscript to get the date of today, such as 06-1-4
Dim CurrentDate
CurrentDate = FormatDateTime(Date, 2)
' GetCurrentDate = 2006-1-4
Dim ExpectedDate
'ExpectedDate = Mid( GetCurrentDate,3)
' ExpectedDate = 06-1-4
Select Case Len(CurrentDate)
' CurrentDate = 2006-1-5(for instance) ' ExpectedDate = 1/5/06 (for instance)
Case 8
ExpectedDate = Cstr( Mid(CurrentDate,6,1)) & "/" & Cstr( Right(CurrentDate,1)) & "/" & Cstr( Mid(CurrentDate,3,2))
Case 9
Rem <<<<<<<<<<<Isnumeric(Mid(CurrentDate,6,2)) is the statement of the month of the date
' CurrentDate = 2006-10-5(for instance) ' ExpectedDate = 10/5/06 (for instance)
If Isnumeric(Mid(CurrentDate,6,2)) Then
ExpectedDate = Cstr( Mid(CurrentDate,6,2)) & "/" & Cstr( Right(CurrentDate,1)) & "/" & Cstr( Mid(CurrentDate,3,2))
' CurrentDate = 2006-1-25(for instance) ' ExpectedDate = 1/25/06 (for instance)
Else ExpectedDate = Cstr( Mid(CurrentDate,6,1)) & "/" & Cstr( Right(CurrentDate,2)) & "/" & Cstr( Mid(CurrentDate,3,2))
End If
Case 10
'CurrentDate = 2006-10-15(for instance) ' ExpectedDate = 10/15/06 (for instance)
ExpectedDate = Cstr( Mid(CurrentDate,6,2)) & "/" & Cstr( Right(CurrentDate,2)) & "/" & Cstr( Mid(CurrentDate,3,2))
End Select
' Msgbox(Cstr(ExpectedDate))
Dim checkedDate
checkedDate = Cstr(ExpectedDate) |
|