Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Conditional time calculation
11-08-2011, 03:53 PM #1
- Join Date
- Nov 2011
- Thanked 0 Times in 0 Posts
Conditional time calculation
I have the following script that is used to disable logins from 9am to 11:30am EST excluding Saturday and Sundays. The script seems to be working from 10:30am EST to 11:30am EST excluding sat/sun but its not working from 9am to 10:30am EST.
Anyone have ideas for me?
Here is the scpirt
<% 'get PST time ServerToOrgHourOffset = 2 ' Daylight saving change Set to three before Nov and set to 2 after mvarOrgCurDtTime = DateAdd("H", mintServerToOrgHourOffset, Now()) mvarOrgCurDt = DateValue(mvarOrgCurDtTime) mvarOrgCurDtDay = Weekday(Date) mvarOrgCurTime = TimeValue(mvarOrgCurDtTime) mvarOrgCurTimeHour = Hour(mvarOrgCurTime) - 2 %> <% Response.Write mvarOrgCurTime Response.Write mvarOrgCurDtDay Response.Write mvarOrgCurTimeHour %> <P> </P></td><td width="732"> <% if (mvarOrgCurTime < "11:30:00 AM")And mvarOrgCurTimeHour >= 7 And mvarOrgCurDtDay <> 7 And mvarOrgCurDtDay <> 1 then %>
<% Else %>
<% End If %>
11-08-2011, 07:35 PM #2
IN VBScript code, date and time constants are *NOT* surrounded by "....". Instead, you need to use #...#.
<% if mvarOrgCurTime < #11:30:00 AM# And mvarOrgCurTimeHour >= 7 _ And mvarOrgCurDtDay <> 7 And mvarOrgCurDtDay <> 1 then %>An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Users who have thanked Old Pedant for this post: