nextwkday(X)

Returns the date of the first weekday on or after a date-related value.

Syntax

nextwkday(X)

Input

Argument Type Description
X any numeric type A scalar value or the name of a column containing date-related values
Valid values can be of the form:
  • date
  • date+time

For more information, see Dates and time.

Return Value

Returns the integer value (in date form) corresponding to the first weekday on or after the date-related value given as input.
Note: Weekdays are Monday through Friday, including holidays.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

In the Hourly U.S. Weather (1993) table (pub.demo.weather.hourly93), you can create a computed column that displays an integer value corresponding to the first weekday on or after the date value in the column named date:

<base table="pub.demo.weather.hourly93"/>
<willbe name="example" value="nextwkday(date)" label="Next Weekday"/>
<colord cols="date,example"/>

For a date value of 06/16/93 (X=19930616), the result would be 06/16/93. (Since 6/16/93 is a Wednesday, which is a weekday, the same date is returned.)

For a date value of 01/02/93 (X=19930102), the result would be 01/04/93. (Since 1/2/93 is a Saturday, the date returned is the first weekday after, which is Monday, 1/4/93.)