This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

  • PHP date_add() Function

  • Definition and Usage

    The date_add() function adds some days, months, years, hours, minutes, and seconds to a date.

    Syntax

    date_add(object, interval)

    Parameter Values

    Parameter Description
    object Required. Specifies a DateTime object returned by date_create()
    interval Required. Specifies a DateInterval object

    Technical Details

    Return Value: Returns a DateTime object on success. FALSE otherwise
    PHP Version: 5.3+
    Example: PHP Date - date_add() Function

    Add 40 days to the 15th of March, 2013:

    <?php
    $date=date_create("2013-03-15");
    date_add($date,date_interval_create_from_date_string("40 days"));
    echo date_format($date,"Y-m-d");
    ?>
    Navigate this PHP reference guide

    Eventually the navigation links, above, will be replaced by these << (previous) and >> (next) buttons below.



    Animated PHP icons used in the buttons provided by ICONS8.COM. Smartphone icons created by Freepik - Flaticon

    PHP Quiz