gerkintrigg Posted August 18, 2006 Share Posted August 18, 2006 Hi everyone!I'm trying to write a script that grabs info from a database where the timestamp of the SQL field is 6 months old or earlier.Can anyone help? My brain's fried. :o(cheers,gerk Link to comment https://forums.phpfreaks.com/topic/17941-time-stamps-comparing-them/ Share on other sites More sharing options...
Daniel0 Posted August 18, 2006 Share Posted August 18, 2006 [code]<?php$timestamp = time()-15768000;$query = mysql_query("SELECT * FROM whatever WHERE date>='{$timestamp}'");?>[/code]Try something like that. I'm now sure if that is what you mean.15768000 = 60*60*24*365/2 - which is a half year (six months).14515200 = 60*60*24*7*4*6 (six months based on four weeks per month). Link to comment https://forums.phpfreaks.com/topic/17941-time-stamps-comparing-them/#findComment-76715 Share on other sites More sharing options...
gerkintrigg Posted August 18, 2006 Author Share Posted August 18, 2006 Yep, thanks very much, that's great Link to comment https://forums.phpfreaks.com/topic/17941-time-stamps-comparing-them/#findComment-76785 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.