Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

ASP date comparison

ASP, date comparison, two dates

7:08 pm on May 17, 2017 (gmt 0)

New User

joined:May 17, 2017
posts: 1
votes: 0

I am trying to have a page that has a button appear only between two dates and times. I used the following code and the button appeared at the correct time (12:01am on 5/15/2017), but then disappeared before the 11:59pm 5/19/2017 when it should have (I believe it disappeared around 9:30 to 10am on 5/15/2017). I'm not sure why, I am guessing there is something incorrect with the date comparison portion of the code that is interpreting the time as 1000?

ctime = FormatDateTime(Now)
if ctime => "5/15/2017 12:01 AM" and ctime <= "5/19/2017 11:59 PM" then %>
Button HTML code
<% end if %>

Would the code below be the correct code to use?

If (Now >= #5/15/2017 12:01 am#) And (Now <= #5/19/2017 11:59 pm#) then %>
Button HTML code
<% end if %>