PHP end of month plus

I was trying to find how to calculate end of the month + 60 days in PHP, took a while but finally got it working using the below code - just change 60 days to whatever you want


    $invoice_date ='now'; //use 'now' if for the current month else add your data here
    $d = new DateTime( $invoice_date );
    $d->modify( 'last day of this month' );
    $d->modify( '+60 days' );
    $due_date = $d->format( 'Y-m-d' );

Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly