Not ASP, logical dilema

Results 1 to 2 of 2

Thread: Not ASP, logical dilema

  1. #1
    Join Date
    Dec 1969

    Default Not ASP, logical dilema

    How would one go about finding out if a time selected would fall between a time range for a graveyard shift using military hours??<BR>say... Time selected:200 hours (am)<BR> Shift: 2230-700<BR>using an if statement to see if the time selected is less than or greater than either times is a double edged sword because 2:00 am is less than 2230 but also less than 7:00am. But then 12:00pm is greater than 2230 and greater than 7:00am. Yet mathematicaly 200 obviously isn&#039;t even in that range.<BR><BR>-stumped

  2. #2
    Join Date
    Dec 1969

    Default Piece of cake

    &nbsp;<BR>&#060;%<BR>startShift = TimeSerial( 22, 30, 0 ) &#039; 2230 hours<BR>endShift = TimeSerial( 7, 0, 0 ) &#039; 0700 hours<BR><BR>&#039; if end is before start, add 24 hours to end<BR>If endShift &#060; startShift Then endShift = DateAdd( "h", 24, endShift )<BR><BR>testTime = TimeSerial( 2, 0, 0 ) &#039; 0200 hours<BR><BR>&#039; and make same test/adjustment with the test time<BR>If testTime &#060; startShift Then testTime = DateAdd( "h", 24, testTime )<BR><BR>&#039; now for the *REAL* test:<BR><BR>If testTime &#062;= startShift AND testTime &#060;= endShift Then<BR> Response.Write "Yes, that time falls in that shift"<BR>Else<BR> Response.Write "No, that time is not in that shift"<BR>End If<BR>%&#062;<BR><BR>The other alternative is to subtract 24 hours from startTime and, if appropriate, from testTime. Mathemetically, that might be easier to "see". <BR><BR> 2230 hours on Monday is the same as -0130 hours on Tuesday, yes?<BR><BR>But on the other hand, 0700 hours on Tuesday is the same as 3100 hours on Monday, yes?<BR><BR>It&#039;s just simple math, that&#039;s all.<BR><BR>

Posting Permissions

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