NextDate

Returns the next date which matches a partially specified date.

Description

Resolves a partially specified date/time into the next (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 future 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.

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