Home > Expression Operators > Date Operators > #DATEMINUS

#DATEMINUS

Subtracts a duration from an end date, returning the start date.

Syntax:

enddate #DATEMINUS duration

Examples:

7/1/1995 #DATEMINUS 1y2m1d equals 4/30/1994

1/1/2008 #DATEMINUS 30y equals 1/1/1978

8/30/2023 #DATEMINUS 6m equals 3/2/2023

This operator is useful for determining an approximate date of hire based on service. For example, if the field SVC95 contains the value 22.5, then 1/1/1995 #DATEMINUS (1y * SVC95) returns 7/1/1972.

Details of calculation:

The year, month and day, are adjusted by the specified durations. If this results in an invalid date (e.g. February 30th), the date is adjusted into the next month. Leap years are considered.

Example:

8/30/2023 #DATEMINUS 6m equals 3/2/2023 (since 2/30/2023 is two days after the last day in February)

8/30/2024 #DATEMINUS 6m equals 3/1/2024 (since, in a leap year, 2/30/2024 is one day after the last day in February)

Related Operators:

#DATEPLUS

If instead you want to measure the number of years between two dates, use #YEARDIF.

If instead you want to measure the number of days between two dates, use - (minus), as in enddate - startdate.