Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    May 2001
    MIA (takittodahous), Florida, USA
    Thanked 0 Times in 0 Posts

    Date Comparisons (2002 SP-2)

    Hey all,

    In your vast collective experience, what is the best way to compare dates in SQL statements? I'm trying to run some comparisons and they don't yield correct answers, though the logic seems fine to me...

    Is it always preferrable to compare date serials as opposed to formatted dates? Currently I have all the dates in the same format, but not serialed. This seems to work fine when I'm genrating dates or changing them (add or subtract time periods). But when I go to choose a date based on comparison criteria (which date is older between two given dates) the logic isn't applying. dunno why.

    How do you usually approach date comparisons?

    Thanks for your assistance!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Date Comparisons (2002 SP-2)

    If you have date fields and/or date functions, you can compare them directly. If you want to use constant dates, put # signs around them, for example #6/30/2003# for 6/30/2003 will be evaluated as "6 divided by 30 divided by 2003". (Note for those outside the USA: you MUST use US date format in SQL).

Posting Permissions

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