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.. Link to comment https://forums.phpfreaks.com/topic/187546-query-for-all-records-within-the-next-24-hours/ 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; Link to comment https://forums.phpfreaks.com/topic/187546-query-for-all-records-within-the-next-24-hours/#findComment-990187 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. Link to comment https://forums.phpfreaks.com/topic/187546-query-for-all-records-within-the-next-24-hours/#findComment-990193 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.. Link to comment https://forums.phpfreaks.com/topic/187546-query-for-all-records-within-the-next-24-hours/#findComment-990195 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.. Link to comment https://forums.phpfreaks.com/topic/187546-query-for-all-records-within-the-next-24-hours/#findComment-990206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.