Wednesday, October 12, 2016

Getting first day of the week in MySql using Week number

Getting first day of the week in MySql using Week number

SELECT
 ADDDATE(CURDATE(), INTERVAL (1 - DAYOFWEEK(CURDATE())) DAY) WeekStart,
 ADDDATE(CURDATE(), INTERVAL (7 - DAYOFWEEK(CURDATE())) DAY) WeekEnd

Reference:

http://stackoverflow.com/questions/3317980/getting-first-day-of-the-week-in-mysql-using-week-no

No comments: