Calc Builder Support

Calc Builder support
No se permite escribir sin estar logado. Por favor, login

Add day 31.03.2017 12:47

Frontend Date format is mm/dd/yy (variable baslangic)
I want to add to 40 day to my variable.
How can I?

// Not correct
$newDate = new JDate($baslangic .' +'.$dayf.' day');
$result= $newDate->format('m/d/Y');


Re: Add day 31.03.2017 13:49

you can try to use php datetime class in order to perform your function, the code should look like:

//create date object from format
$newDate = DateTime::createFromFormat('m/d/y', $baslangic);
//add interval
$newDate->modify('+'.$dayf.' days');
//return formatted new date

That should do the work, format to be used here is 'm/d/y' if you use 2 digits for year, or,


in case you use the 4 digits format.

Hope this helps, regards
Moonsoft Team

Re: Add day 31.03.2017 14:24

Thanks support.

Code produces incorrect results.

Sample baslangic is 01/01/2017
Result: 10/02/2017 This is correct

Sample baslangic is 30/01/2017
Result: 11/07/2019 This is not correct.

I can tired code:

//create date object from format
$newDate = DateTime::createFromFormat('m/d/Y', $baslangic);
//add interval
$newDate->modify('+'.$dayf.' days');
//return formatted new date

Re: Add day 31.03.2017 16:37

are you sure the date format is the right one? You said you're using mm/dd/yy format, but from your example:


seems you're using dd/mm/yy instead? If so, you only need to correct the date format to


at the 2 date functions (createfromformat and format) in order to get the right results. If the format is not the exact one you'll be getting weird unexpected results when adding the days.

Moonsoft Team

Re: Add day 02.04.2017 18:15

Thanks, It is work.
You are perfect.
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

Lo que nuestros clientes opinan de nosotros