dim loginDate as Date
loginDate = Date这时能获职系统当前日期(年-月-日)
我希望仅修改其中的年
if (Year(loginDate)=2004) then
将该loginDate的年设为2008年
如何实现
end if
loginDate = Date这时能获职系统当前日期(年-月-日)
我希望仅修改其中的年
if (Year(loginDate)=2004) then
将该loginDate的年设为2008年
如何实现
end if
Dim loginDate As Date
loginDate = Date
If Year(loginDate) = 2004 Then
If IsDate(Year(loginDate) + 4 & "-" & Month(loginDate) & "-" & Day(loginDate)) Then
loginDate = CDate(Year(loginDate) + 4 & "-" & Month(loginDate) & "-" & Day(loginDate))
Else
If IsDate(Year(loginDate) + 4 & "-" & Month(loginDate) & "-" & Day(loginDate) - 1) Then
loginDate = CDate(Year(loginDate) + 4 & "-" & Month(loginDate) & "-" & Day(loginDate) - 1)
End If
End If
End If
MsgBox loginDate
End Sub
month=month(date())
day=day(date())return=dateserial(NEW_YEAR,month,day)
loginDate = Date
If Year(loginDate) = 2004 Then
loginDate = "2008-" & Format(loginDate, "mm-dd")
End If