Wednesday, 28 June 2017

MySQL: Going from week of the year to date of the Monday

SELECT DATE(DATE_SUB('2004-07-30', INTERVAL DAYOFWEEK('2004-07-30')-2 DAY));
You need to subtract 2 in the interval because the "DAYOFWEEK" array starts with 1.
Sunday = 1 
Monday = 2 
etc.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive