Vivid Lust Posted March 3, 2010 Share Posted March 3, 2010 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! Link to comment https://forums.phpfreaks.com/topic/194030-mysql-to-get-all-records-in-last-week-by-timestamp-in-format-1267641902/ Share on other sites More sharing options...
jcanker Posted March 3, 2010 Share Posted March 3, 2010 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. Link to comment https://forums.phpfreaks.com/topic/194030-mysql-to-get-all-records-in-last-week-by-timestamp-in-format-1267641902/#findComment-1021014 Share on other sites More sharing options...
Vivid Lust Posted March 3, 2010 Author Share Posted March 3, 2010 I haven't got the option to change it, any help? thanks. Link to comment https://forums.phpfreaks.com/topic/194030-mysql-to-get-all-records-in-last-week-by-timestamp-in-format-1267641902/#findComment-1021019 Share on other sites More sharing options...
Vivid Lust Posted March 4, 2010 Author Share Posted March 4, 2010 Anyone please? Anyway to put the results into an array and then compare? Link to comment https://forums.phpfreaks.com/topic/194030-mysql-to-get-all-records-in-last-week-by-timestamp-in-format-1267641902/#findComment-1021611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.