WEEKDAY Function

Description

The WEEKDAY function returns the day of week in the range of 0 to 6 (0: Sunday, 1: Monday, ..., 6: Saturday) from the specified parameter. The day of week index is same as the ODBC standards. You can specify DATE, TIMESTAMP, DATETIME types as parameters and an INTEGER type will be returned.

Syntax

WEEKDAY(date)

Example

SELECT WEEKDAY('2010-09-09');

   weekday('2010-09-09')

========================

                       3

 

SELECT WEEKDAY('2010-09-09 13:16:00');

   weekday('2010-09-09 13:16:00')

=================================

                                3

 

SELECT WEEKDAY('10:28:00');

 

ERROR: Conversion error in date format.