ADDTODATE

Syntax

ADDTODATE(<date> <string, using date constant>)

Description

Adds (or subtracts) time to a date using an integer and one date constant.

Time unitConstantNote
Yeary
QuarterqAs of Datameer 7.4
MonthM
WeekwAs of Datameer 7.4
Dayd
Hourh
Minutem
Seconds
Millisecondms

This function can be used to subtract time away from a date by using the method above with a minus sign "-" before the integer and constant.

The function respects Daylight Saving Time (DST). Depending on the date "-1d" could also subtract 23 or 25 hours when used with this function. Learn more in our knowledge base article about how this function works.

Examples

DateString usedADDTODATE result
Oct 15, 2002 04:36:34 AM5yOct 15, 2007 04:36:34 AM
Oct 15, 2002 04:36:34 AM3MJan 15, 2003 04:36:34 AM
Oct 15, 2002 04:36:34 AM5000s

Oct 15, 2002 06:29:54 PM

Oct 15, 2002 04:36:34 AM-5000s

Oct 14, 2002 02:43:14 PM

Datameer 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