defroster Posted December 6, 2011 Share Posted December 6, 2011 Hello, I have entries going into a mySQL database. They all have a date+timestamp associated with each entry. Some entries are future dates (like a week from now). How do I select the entries from the past 36 hours up to now() but ignore the future entries? Thanks a million /df Quote Link to comment https://forums.phpfreaks.com/topic/252601-select-entries-from-the-past-36-hours-now-but-not-in-the-future/ Share on other sites More sharing options...
gizmola Posted December 6, 2011 Share Posted December 6, 2011 You can use a Between query based on NOW(). See http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html as the technique needed to determine how to get the past 36 hours is illustrated there. Rather than days, use HOURS (-36 HOURS). So it would be between that and NOW(). Quote Link to comment https://forums.phpfreaks.com/topic/252601-select-entries-from-the-past-36-hours-now-but-not-in-the-future/#findComment-1295031 Share on other sites More sharing options...
defroster Posted December 6, 2011 Author Share Posted December 6, 2011 Thanks. That worked well! Quote Link to comment https://forums.phpfreaks.com/topic/252601-select-entries-from-the-past-36-hours-now-but-not-in-the-future/#findComment-1295070 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.