ADDTODATE
Syntax
ADDTODATE(<date> <string/ another column + date constant>)
Description
Adds (or subtracts) time to a date using an integer and one date constant or another column + date constant.
Time unit | Constant |
---|---|
Year | y |
Quarter | q |
Month | M |
Week | w |
Day | d |
Hour | h |
Minute | m |
Second | s |
Millisecond | ms |
Examples
Date | String used | ADDTODATE result |
---|---|---|
Oct 15, 2002 04:36:34 AM | 5y | Oct 15, 2007 04:36:34 AM |
Oct 15, 2002 04:36:34 AM | 3M | Jan 15, 2003 04:36:34 AM |
Oct 15, 2002 04:36:34 AM | 5000s | Oct 15, 2002 06:29:54 PM |
Oct 15, 2002 04:36:34 AM | -5000s | Oct 14, 2002 02:43:14 PM |
Datameer X always uses the following format:
Three character month abbreviation (space) two digit day (comma)(space) four digit year (space) two digit hour (colon) two digit minute (colon) two digit second (space) two character meridiem notation.
(e.g., 12.01.2012 gets transferred to Jan 12, 2012 12:00:00 AM)
When selecting a pattern, you select the way the data gets parsed (your input format, this can be connected to your systems representation of dates and times).
Additional Information
Make Date Functions Aware of Daylight Savings Time
To make a function aware of daylight savings time (DST) use ADDTODATE in order to add or subtract time from a date.
Example
=EXPAND_DATE_RANGE(ADDTODATE(TODAY();"-5000d");TODAY();1d)
This is also recommended when working with Partitioned Data and Advanced Partition Filter.
Example
In order to catch the last seven days of the previous month in a workbook using a formula that repeats daylight savings time.
$partition < ENDOFMONTH(STARTOFMONTH(ADDTODATE(TODAY();"-1M"))) && $partition >= ENDOFMONTH(STARTOFMONTH(ADDTODATE(TODAY();"-1M")))-7d