Scooby08 Posted February 5, 2010 Share Posted February 5, 2010 I had this query working before to select all records with a date that was within the next 24 hours, but it wasn't with timestamps.. SELECT * FROM table WHERE (Time_TS BETWEEN NOW() AND NOW() + INTERVAL 24 HOUR) My timestamps are retrieved from an XML file and look like this: 1265414700000 What do I need to change for timestamps? I also tried this: SELECT * FROM table WHERE (Time_TS BETWEEN CURRENT_TIMESTAMP() AND CURRENT_TIMESTAMP() + INTERVAL 24 HOUR) Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/191010-selecting-the-next-24-hours-timestamps/ Share on other sites More sharing options...
RussellReal Posted February 5, 2010 Share Posted February 5, 2010 current_timestamp() is an int not a date, so increasing it by an interval will probably not work. try CURRENT_TIMESTAMP() + (60 * 60 * 24) Quote Link to comment https://forums.phpfreaks.com/topic/191010-selecting-the-next-24-hours-timestamps/#findComment-1007273 Share on other sites More sharing options...
Scooby08 Posted February 5, 2010 Author Share Posted February 5, 2010 Thanks for the reply! Unfortunately I couldn't get that one to work.. I'm gonna try formatting the timestamp to a datetime format before inserting into the database and see if that works out.. Quote Link to comment https://forums.phpfreaks.com/topic/191010-selecting-the-next-24-hours-timestamps/#findComment-1007275 Share on other sites More sharing options...
Scooby08 Posted February 5, 2010 Author Share Posted February 5, 2010 Well what do you know.. Works great now with my original query.. Quote Link to comment https://forums.phpfreaks.com/topic/191010-selecting-the-next-24-hours-timestamps/#findComment-1007278 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.