Jump to: navigation, search

Mysql DAYOFWEEK

From w3cyberlearnings

Contents

MySQL DAYOFWEEK Function

This function returns the day of a week, i.e 1=Sunday, 2=Monday, ...7=Saturday.

Syntax DAYOFWEEK

DAYOFWEEK(expre);

Example 1

This is Tuesday=3

mysql> SELECT DAYOFWEEK('2012-05-22');
+-------------------------+
| DAYOFWEEK('2012-05-22') |
+-------------------------+
|                       3 |
+-------------------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT DAYOFWEEK('2012-05-21');
+-------------------------+
| DAYOFWEEK('2012-05-21') |
+-------------------------+
|                       2 |
+-------------------------+
1 row in set (0.00 sec)

Related Links



Navigation
Web
SQL
MISC
References