Was this page helpful?

Date.AddYears

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Parameters
    3. 3. Result
    4. 4. Samples
    date.AddYears(datetime : str, years : num) : str

    Adds the specified number of years to a date and returns the result.  The number of years can be positive or negative. 

    Usage Restrictions

    1.9.1 or later.

    Parameters

    Name Type Description
    datetime
    str The date to which to add years.
    years
    num
    The number of years to add.

    Result

    A new date.

    Samples


    Output

    To subtract 100 years from the current date:

    {{ date.AddYears(date.now, -100) }} 

    Sat, 25 May 1912 08:08:22 GMT

    To add 100 years to a constant date:

    {{ date.AddYears("01/01/2000", 100) }} 

    Fri, 01 Jan 2100 00:00:00 GMT

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by