Jump to: navigation, search

Mysql WEEKDAY

From w3cyberlearnings

Contents

MySQL WEEKDAY Function

This function returns the week day. (0=Monday, 1=Tuesday, 2=Wednesday,.. 6=Sunday)

Syntax WEEKDAY

  • expre: date or datetime expression
WEEKDAY(expre);

Example 1

  • The '2012-05-22' is fall in Tuesday.
mysql> SELECT WEEKDAY('2012-05-22');
+-----------------------+
| WEEKDAY('2012-05-22') |
+-----------------------+
|                     1 |
+-----------------------+
1 row in set (0.00 sec)

Example 2

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

Related Links



Navigation
Web
SQL
MISC
References