Scooby08 Posted January 7, 2010 Share Posted January 7, 2010 I thought this would be easy, but I just can't seem to figure out how to query all the records within the next 24 hours.. I have a datefield for each record like so: 1/7/2010 8:35:48 PM Can't seem to find a solution online either.. Only for the past 24 hours.. Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 7, 2010 Share Posted January 7, 2010 SELECT columns FROM tableName WHERE dateField BETWEEN NOW() AND NOW() + INTERVAL 24 HOUR; Quote Link to comment Share on other sites More sharing options...
tomdchi Posted January 7, 2010 Share Posted January 7, 2010 will that work even though the date is formated with /, not in mysql format, and the time is in 12 hour format? This is precisely why you should convert dates to mysql format when saving to the db. Quote Link to comment Share on other sites More sharing options...
Scooby08 Posted January 7, 2010 Author Share Posted January 7, 2010 That has to be why it's not working... Trying that idea out.. Quote Link to comment Share on other sites More sharing options...
Scooby08 Posted January 7, 2010 Author Share Posted January 7, 2010 Well that was definitely it!! Gotta convert those dates.. Thanks guys.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.