SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pull in time() values

    Hi guys

    I'm currently using the following piece of script to perform an action based on a certain time of day:

    <% If Time() >= #19:30:00# AND Time() <= #20:30:00# Then %>
    do this
    <%end if%>

    So, in the example above I can get the page to perform a certain action between the time of 19.30 and 20.30. This is just fine, however I need to pull in the time values (ie "19:30:00" and "20:30:00") from a querystring. So, my url would look something like

    ../mypage.asp?starttime=19:30:00&endtime=20:30:00

    and these values would be pulled into the code.

    Is this possible and if so, how is it done? Any help would be fully appreciated

    Best regards

    Rod from the UK

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    691
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Something like this

    <%

    Dim vStartTime,vEndTime
    vStartTime=TimeValue(Request.QueryString("starttime"))
    vEndTime =TimeValue(Request.QueryString("endtime"))

    response.write Time() & "<br>"
    response.write "vStartTime=" & vStartTime & "<br>"
    response.write "vEndTime=" & vEndTime & "<br>"


    If Time() >= vStartTime AND Time() <= vEndTime Then
    response.write "success" & "<br>"
    else
    response.write "failure" & "<br>"
    end if

    %>

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Excellent - thank you!

    Best regards

    Rod from the UK


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •