Created
April 2, 2016 08:51
-
-
Save heyost/eb656e13bc6e23d38050fe2bf160d571 to your computer and use it in GitHub Desktop.
Get some week between date in MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1 week past | |
SELECT DATE_ADD("2016-02-04", INTERVAL(-6-DAYOFWEEK("2016-02-04")) DAY) AS start, DATE_ADD("2016-02-04", INTERVAL(0-DAYOFWEEK("2016-02-04")) DAY) AS FINISH | |
# present week | |
SELECT DATE_ADD("2016-02-04", INTERVAL(1-DAYOFWEEK("2016-02-04")) DAY) AS start, DATE_ADD("2016-02-04", INTERVAL(7-DAYOFWEEK("2016-02-04")) DAY) AS FINISH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment