sylunt1 Posted January 18, 2008 Share Posted January 18, 2008 Hello... Here is what I am trying to do.... I want to take $tse_start and add 28 days to it and have that be $tse_estlive which will then be inserted in to mysql. $tse_start is a date field that is being posted from a form on a previous page. I am thinking something like this... but as it is - no luck $tse_estlive = mktime(0, 0, 0, $tse_start("m") , $tse_start("d")+28, $tse_start("Y")); Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/86697-php-date-calculations/ Share on other sites More sharing options...
p2grace Posted January 18, 2008 Share Posted January 18, 2008 Try this: $expire = mktime(0,0,0, date("m") , date("d")+28, date("Y")); Quote Link to comment https://forums.phpfreaks.com/topic/86697-php-date-calculations/#findComment-443054 Share on other sites More sharing options...
remyaarun Posted January 18, 2008 Share Posted January 18, 2008 $expdate = date("M-d-Y",mktime(0,0,0, date("m")+28, date("d"), date("Y"))); Quote Link to comment https://forums.phpfreaks.com/topic/86697-php-date-calculations/#findComment-443069 Share on other sites More sharing options...
KrisNz Posted January 18, 2008 Share Posted January 18, 2008 Theres also the strtotime() function e.g //assuming $tse_start is a timestamp $tse_estlive = strtotime("+28 day",$tse_start); //if its not... $tse_estlive = strtotime("+28 day",strtotime($tse_start)); Quote Link to comment https://forums.phpfreaks.com/topic/86697-php-date-calculations/#findComment-443073 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.