Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Add Number of Days and format Correctly 05.02.2016 17:27

I am trying to make a calculator that takes the date format adds 90 days to it and outputs the result in mm/dd/yy format. This is the code I have so far but I just cant get it to work:

$aDate = new DateTime($arrestDate);
$mDate = new DateInterval('P90D');
$fDate = new DateInterval('P175D');


$speedydate = date_add($adate,$mdate);
It doesnt seem to like the date_add

Please help

Thanks

Phil

Re: Add Number of Days and format Correctly 05.02.2016 20:10

Hi,
your code seems correct, but you have passed the parameters to date_add without the uppercases inside (aDate, mDate,) this should do the work:


$speedydate = date_add($aDate,$mDate);

//and now you can print with your preferred format

$formatedspeedydate=date_format($speedydate, 'm-d-Y');


Hope this helps, regards
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect
FaLang translation system by Faboba

Our clients' feedback