Jump to content

Select entries from the past 36 hours -> now() but not in the future


defroster

Recommended Posts

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

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().

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.