Last active
October 21, 2015 08:01
-
-
Save shevabam/da781f9297c7fbfd2c4f to your computer and use it in GitHub Desktop.
SQL - Get first and last day (monday/sunday) in a date
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
SELECT | |
DATE_ADD(CURRENT_DATE, INTERVAL(2-DAYOFWEEK(CURRENT_DATE)) DAY) AS start_day, | |
DATE_ADD(CURRENT_DATE, INTERVAL(8-DAYOFWEEK(CURRENT_DATE)) DAY) AS end_day; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment