Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dates leave me in a bad state

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
I'm trying to a retrieve records that are between between 2 dates

SELECT * FROM TABLE
WHERE Dateposted >= '2001/5/1' AND Dateposted <= '2001/5/31'

Well this works fine for records 2001/5/10 upwards but a date like 2001/5/8 is not brought up even though it's there in the database.

I've tried putting the date all different ways and with 08 and 05 it still doesn't work.

Please, Please is there a way out of this quandrey

Gavin
 
Are the dates stored in datetime format or are they stored as strings. From what you are saying, it would seem that there are stores as strings as 2001/5/8 would be greater than 2001/5/31 if they were strings.

You need to convert the dates to date format before you compare them. Mise Le Meas,

Mighty :)
 
thanks

yes durrrH! the field in the database wasn't set to date/time small format

mad!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top