Skip to main content Skip to complementary content
Close announcements banner

addToDateTime

Adds an amount of time to a datetime.

Arguments

  1. Unit to add as a string:
    • Year, Years, Y or u for years
    • Month, Months, M or L for months
    • Week, Weeks or W for weeks
    • Day, Days or d for days
    • Hour, Hours or H for hours
    • Minute, Minutes or m for minutes
    • Second, Seconds or s for seconds
    • Millisecond, Milliseconds or A for milliseconds
  2. Amount to add as a long. It can be a negative value to subtract an amount of time.
  3. Input datetime.

Examples

Expression Result
addToDateTime("M", -1, "2021-03-21T10:19:26.214+02:00") 2021-02-21T10:19:26.214+02:00

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!