WEEKDAY Function

Purpose

Returns either the day of the week corresponding to the current day or the specified DAYS value.

Syntax

WEEKDAY (x)

Parameters

x is an expression. x specifies the input date as days. If not specified, the value for DAYS() is used. If not specified and the current date is not available from the system, the return is zero (0).

x must have a computational type and is converted to FIXED BINARY(31,0) if necessary.

Description

The WEEKDAY function returns a FIXED BINARY(31,0) value that is the number of days x converted to the day of the week, where:

  • 1 = Sunday
  • 2 = Monday
  • 3 = Tuesday
  • 4 = Wednesday
  • 5 = Thursday
  • 6 = Friday
  • 7 = Saturday

If not specified, x is the DAYS for the current day of the week.

Examples

See the example in the SECS Function topic to see how WEEKDAY can be used.

Restrictions

None.