MENU
    addMonths
    • 09 Apr 2021
    • 1 Minute to read
    • Contributors

    addMonths


    Article summary

    Description

    Returns a DateTime object with a specified number of months added to today's date. Both positive and negative values are supported to either add or subtract the specified amount of time.


    Input Parameters

    NameTypeRequiredDescription
    valueNumberYesNumber of months to add or subtract

    Returns

    Type: DateTime

    Returns a new DateTime value with the adjusted time component.


    Examples

    // returns a new DateTime with 3 months added from today
    var date = tools.addMonths(3);
    JavaScript
    // returns a new DateTime with 3 months subtracted from today
    var date = tools.addMonths(-3);
    JavaScript

    Remarks

    Use this helper function when you want to create offset DateTime values computed from today's date and time.