Skip to main content

toDayOfWeek

Converts a date or date with time to a UInt8 number containing the number of the day of the week (Monday is 1, and Sunday is 7).

Syntax

toDayOfWeek( <expr> )

Arguments

ArgumentsDescription
<expr>date/datetime

Return Type

UInt8 datatype.

Examples

SELECT toDayOfWeek(to_date(18869));
+----------------------------+
| toDayOfWeek(to_date(18869)) |
+----------------------------+
| 1 |
+----------------------------+

SELECT toDayOfWeek(now());
+--------------------+
| toDayOfWeek(now()) |
+--------------------+
| 2 |
+--------------------+