Adding Days to Date

3 posts by 2 authors in: Forums > CMS Builder
Last Post: July 22, 2017   (RSS)

By Dave - July 21, 2017

Hi Kenny, 

No worries, try this (added concatenation operator "." before ' + 15 days: 

  echo date('Y-m-d', strtotime($invoicesRecord['createdDate'] .' + 15 days'));

Also, sometimes what I do what the there's a lot of syntactic noise (operators and characters all bunched together) is break it down into multiple simple statements: 

$createdDate  = $invoicesRecord['createdDate'];
$dateIn15Days = strtotime("$createdDate + 15 days");
echo date('Y-m-d', $dateIn15Days);

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By KennyH - July 22, 2017

That worked great!

Thanks, Dave

Kenny