Hey guys,
I've setup a 'switch' so that after a certain date and time something will change.
We use classic ASP here sadly so I'm just wondering how can I get this switch to work correctly?
Currently it does work but as the date will never be the same that is not an issue, however time is.
<%
'JH - Turn of colleagues at 14th October 2011, at 09:00
'Store variables
dim curDate, switchDate, diffDate, datePassed
curDate = date()
switchDate = "14/10/2011"
curTime = FormatDateTime(time(),4)
switchTime = "09:00"
datePassed = ""
'Check difference of dates
diffDate = dateDiff("d", switchDate, curDate)
diffTime = dateDiff("h", switchTime, curTime)
'Set a flag to make switch occur
If diffDate >= 0 and diffTime >= 0 Then
datePassed = "Y"
Else
datePassed = "N"
End If
%>
hence by using <% If datePassed = "Y" Then %> I can determine content and use an <% else %> for the current content.
My problem is that diffDate will never return under 0 as, like I said, the date will never be the same.
Whereas when the time reaches 23:59 it's going to go to midnight and fall to a negative number and cause the switch to reverse itself after the first occurence. Is there a way I can solve this?
Thanks,
Jack
Bookmarks