adzie Posted August 14, 2008 Share Posted August 14, 2008 Hello I'm trying to add 60 days the acars date (this displays the date in the format 2008-07-06) $acars=substr($lastaar,0,10); $nyr=substr($lastaar,0,4); $nmth=substr($lastaar,5,2); $nday=substr($lastaar,8,2); $ndate = (($nyr * 365) + ($nmth * 30) + ($nday)); When I tried $raid = $acars+60; All is get is the year from above plus 60 years display. How can I get it to add 60 days? thanks Link to comment https://forums.phpfreaks.com/topic/119744-date-60-days/ Share on other sites More sharing options...
Daniel0 Posted August 14, 2008 Share Posted August 14, 2008 Try to take a look at strtotime() and date(). Link to comment https://forums.phpfreaks.com/topic/119744-date-60-days/#findComment-616935 Share on other sites More sharing options...
kenrbnsn Posted August 14, 2008 Share Posted August 14, 2008 Use the strtotime() and date() functions. <?php $str = '2008-07-06'; $str60 = date('Y-m-d',strtotime($str . ' +60 days')); echo $str60; ?> Ken Link to comment https://forums.phpfreaks.com/topic/119744-date-60-days/#findComment-616937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.