Was this page helpful?

Date.AddHours

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

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

    Usage Restrictions

    1.9.1 or later.

    Parameters

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

    Result

    A new date.

    Samples


    Output

    To subtract 2 hours from the current date:

    {{ date.AddHours(date.now, -2) }} 

    Wed, 19 Jun 2013 07:38:21 GMT

    To add 2 hours to a constant date:

    {{ date.AddHours("January, 1, 2000", 2) }} 

    Sat, 01 Jan 2000 22:00:00 +20:00

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

    Copyright © 2011 MindTouch, Inc. Powered by