date comparison

Results 1 to 2 of 2

Thread: date comparison

  1. #1
    Join Date
    Dec 1969

    Default date comparison

    My question is simple, what is the best way to compare time.<BR>For instance, <BR><BR>if time = 3:00pm then<BR> .....<BR>end if<BR><BR>the time may be in military format(24 hour) or normal format(with am and pm) Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default Compare against a constant?

    &nbsp;<BR>Lots of ways...<BR><BR>If Time = #3:00:00 PM#<BR><BR>If Time = #15:00:00#<BR><BR>If Time = TimeSerial( 15, 0, 0 )<BR><BR>If Time = TimeValue( CDate( "15:00:00") ) &#039 that one might need a date, also<BR><BR>etc.<BR><BR>Of course, testing for = with a time is problematic. You need to get it right to the second.<BR><BR>You might prefer something like this:<BR><BR>If Abs( DateDiff("s",Time,#15:00:00#) ) &#060; 10 Then<BR><BR>which will trigger any time with 10 seconds of 3PM, either way.<BR><BR><BR>Curl up with a good VBScript reference manual and run through all the functions available. There are more I didn&#039t mention, I am sure.<BR><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