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 Quote Link to comment 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). Quote Link to comment 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 Quote Link to comment 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.