PreviousDate

Returns the previous date which matches a partially specified date.

Description

Resolves a partially specified date/time into the previous (with respect to a reference date) date/time which matches the specified fields.

Type

DATETIME

Arguments

Type

Meaning

1

DATETIME

a reference date/time.

2

DATETIME

a partially specified date/time.

Evaluation

The unspecified fields with a coarser resolution are resolved into the past with respect to the reference date. If there are finer resolution fields, they are filled in with default values (e.g., time with 24:00, day of the month with the last day of the month). Note that if the partial date can be resolved into the current date, it is. See the "Syntax Examples" section below for some examples.

Comments

If the reference date/time is not fully specified or if the partial date/time is, then the run is aborted with an error.

 
PreviousDate(@"t", @"March")
returns: 24:00 March 31, 1994
(assuming the t is any date between March, 1994 and March, 1995)
PreviousDate(@"24:00 May 10, 1995", @"March 20")
returns: 24:00 March 20, 1994
PreviousDate(@"24:00 February 28, 1994", @"MAX DayOfMonth")
returns: February 28, 1994
PreviousDate(@"24:00 February 28, 1994", @"Tuesday")
returns: 24:00 February 22, 1994
PreviousDate(@"24:00 February 28, 1994", @"6:00 MAX DayOfYear")
returns: 6:00 December 31, 1993
PreviousDate(@"24:00 February 28, 1994", @"6:00")
returns: 6:00 February 28, 1994