SQL and date

Results 1 to 3 of 3

Thread: SQL and date

  1. #1
    Join Date
    Dec 1969

    Default SQL and date

    I am trying to write a SELECT statement that would select * from a certain table where the date field is less than 2 months old.<BR>Is there a way to do this by using the SQL syntax and not ASP&#039;s date/time functions?

  2. #2
    Join Date
    Dec 1969

    Default Well,

    most DBMS has support for datetime arithmetics. Unfortunately they almost all differ from each other and from the SQL standard. So, which dbms are you using?

  3. #3
    Join Date
    Dec 1969

    Default Just an Idea

    Well i read your message, and I have to admit that Dates are the bain of my life.. so I have a simple solution that is cross platform and i use it all the time if i get stuck with dates, as I do cos I&#039;m always having to add on new features to sites where people have stored dates as strings.. nasty habit folk have!<BR><BR>When you have a date stored in a field, simply add another column to your database and store the date as a reversed date,<BR>ie: 01/04/2002 becomes 20020401<BR>this makes it easier to perform searches by date, well i think so, and not much can go wrong with it.<BR><BR>email me at nathan@netformatt.co.uk if you want to know more cos i don&#039;t have time to put up loads of example coding here. But i do have some handy functions i have made that slice up dates and convert them into backwards dates so...

Posting Permissions

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