Results 1 to 4 of 4

Thread: How would YOU do this? *RESOLVED*

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    53

    How would YOU do this? *RESOLVED*

    I would like to have a page that loads different data from a database based solely on what time of day it is. For instance, if it's between 11:00 AM and 1:00 PM, then DO THIS. Does anyone have any links or suggestions on working with time in ASP or ASP.Net? Thanks!

    HWOODKY
    Last edited by HollywoodKY; Mar 12th, 2004 at 12:16 AM.

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    in your query do this:

    WHERE MyDateTime BETWEEN(FirstDateTime, LastDateTime)

    or something to that affect.

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    53
    Actually, I'm wanting it to use the system time to determine what the page should display. If its between 12:00PM and 4:00PM, then display "this" page. The problem I'm running into is comparing the times and formulating an IF THEN statement. It would basically look like this:

    On Page Load

    If "System Time" > 11:59 AM AND < 4:01 PM Then
    Load SampleSub
    ElseIf "SystemTime" >4:00 PM AND < 10:01 PM Then
    Load SampleSub2
    End If

    I'm pretty clueless as to how to formulate that statement... any ideas?

    HWOODKY

  4. #4
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    VB Code:
    1. IF now.hour >= 0 AND now.hour < 16 THEN
    2.     Load SampleSub
    3. ELSEIF now.hour >= 16 AND now.hour < 22 THEN
    4.     Load SampleSub2
    5. END IF
    Is that what you need?
    Now.minute, now.second,now.millisecond (and pretty much any other measure of time really) are also available if you need to narrow it down further. All return integer values.
    Last edited by Fishcake; Mar 9th, 2004 at 08:25 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width