Comparing dates

Results 1 to 4 of 4

Thread: Comparing dates

  1. #1
    Jenny Guest

    Default Comparing dates

    Is there a reason why:<BR>if mydate &#062; now() then<BR>.....<BR>does not work. It does not seem to be able to comapre the two.<BR><BR><BR>Thanks Jenny<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Comparing dates

    This client side code worked for me...<BR>I guess that you need to ensure that you are comparing 2 dates<BR><BR>&#060;SCRIPT language="vbscript"&#062;<BR>&#039;set up a couple af variables to compare<BR><BR> myDate=formatdatetime(now(),1)<BR> myDate2=formatdatetime("01-jan-2001",1)<BR><BR>&#039;Compare them <BR> If myDate &#062;myDate2 then <BR> msgbox mydate & " is GREATER than " & myDate2 <BR> else<BR> msgbox mydate & " is LESS than " & myDate2<BR> end if<BR>&#060;/SCRIPT&#062;<BR>

  3. #3
    Lurker Guest

    Default RE: Comparing dates

    Try using Date() instead of now() as now() also contains the current time.<BR><BR>You could also try using datediff E.g.<BR><BR>If DateDiff("d", MyDate, Date()) &#060;&#062; 0 then<BR>...<BR>End if

  4. #4
    Jenny Guest

    Default RE: Comparing dates

    Sorry I had used date(). Unfortunately I made the mistake of putting now() in the original.<BR><BR>I beleieve that I have used someting like if now() &#062; cr(now()) before. I think it was cr (at least it began with either c or s!!!) any ideas? thanks

Posting Permissions

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