shage Posted July 3, 2007 Share Posted July 3, 2007 anyone know a way to look at say 2007-07-01 and if its over 30 days old switch it to new month? Quote Link to comment Share on other sites More sharing options...
shage Posted July 3, 2007 Author Share Posted July 3, 2007 i know its hard Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 3, 2007 Share Posted July 3, 2007 If you rephrase that and put it into some sort of context, you'll probably get a good answer. Meantime, check the user notes at http://ca.php.net/manual/en/function.date.php Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 3, 2007 Share Posted July 3, 2007 i dont know how it could be done in other way but can you have this the date here =now() and the date here <= 2007-06-01 Quote Link to comment Share on other sites More sharing options...
shage Posted July 3, 2007 Author Share Posted July 3, 2007 i dont know how much more detailed i can get, what its idea is to look in db and make dates updated a month. So script will query then if date is over 30 days old then change date to one month later so 6-1 will be 7-1 etc Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted July 3, 2007 Share Posted July 3, 2007 $date = "2007-07-01"; if(strtotime("{$date} +30 days") > time()) { $date = strtotime("{$date} +1 month"); } But I don't see why you would do that... Quote Link to comment Share on other sites More sharing options...
no_one Posted July 3, 2007 Share Posted July 3, 2007 In DB? Maybe something like: <?php // testing 1 month.. $qry = "Update tbl set row_date=DATE_ADD(row_date, INTERVAL 1 MONTH) where PERIOD_DIFF(DATE_FORMAT(CURDATE(),"%Y%m"),DATE_FORMAT(row_date,"%Y%m")) >= 1 "; // or testing 30 days .. $qry = "Update tbl set row_date=DATE_ADD(row_date, INTERVAL 1 MONTH) where DATEDIFF(CURDATE(),row_date) > 30"; ?> I could be wrong though.. usually am. 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.