SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
D-17
DAYOFWEEK Function
DAYOFWEEK Function
DAYOFWEEK is a function that reads a date-time expression and returns a type
INTEGER value in the range 1 through 7 that represents the day of the week
expressed by the date-time value. The value 1 represents Sunday, 2 represents
Monday, and so forth.
date-time-expression
is an expression that evaluates to a value of type DATETIME, DATE, TIME, or
TIMESTAMP.
Example—DAYOFWEEK
This function call returns an integer that represents the day of the week from a date-
time value in the START_DATE column of a table named PROJECTS:
SELECT DAYOFWEEK(START_DATE) FROM PROJECTS
WHERE PROJECT_NAME = "920";
If the row selected looks like :
PROJECT_NAME START_DATE END_DATE WAIT_TIME
------------ ---------------- ---------------- ---------
920 1993-02-24:20:30 1995-03-21:20:30 20
the value returned is 1, representing Sunday.
DAYOFWEEK ( date-time-expression )