Mysql WEEKOFYEAR
From w3cyberlearnings
Contents |
MySQL WEEKOFYEAR Function
This function converts the date as a number of week in the range of 1 to 53. You can also use the WEEK() function, as WEEK(date,3) to get the same result.
Syntax WEEKOFYEAR
X is a date or datetime
WEEKOFYEAR(X)
Example 1
mysql> SELECT WEEKOFYEAR('2015-01-09'); +--------------------------+ | WEEKOFYEAR('2015-01-09') | +--------------------------+ | 2 | +--------------------------+ 1 row in set (0.01 sec)
Example 2
mysql> SELECT WEEKOFYEAR('2015-04-09'); +--------------------------+ | WEEKOFYEAR('2015-04-09') | +--------------------------+ | 15 | +--------------------------+ 1 row in set (0.00 sec)
Example 3
mysql> SELECT WEEK('2015-01-09',3); +----------------------+ | WEEK('2015-01-09',3) | +----------------------+ | 2 | +----------------------+ 1 row in set (0.00 sec)