Jump to content

mysql to get all records in last week by timestamp in format 1267641902


Vivid Lust

Recommended Posts

I have the code to get all the records in the past 7 days for a mysql timestamp:

 

WHERE LastOnline < DATE_ADD(NOW(), INTERVAL -7 DAY)

 

 

However when the timestamp, or php time, is in the format 1267641902 its not working, how could i get this to work sucessfully?

 

thanks all!

PHP and MySql use different date formats for timestamp.  What type of column is the MySQL using?  Personally, I always just create the column as a bigint and store the raw value of the unix timestamp generated by php in that column.  That way you can perform any math function, including > or < easily. 

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.