Created
November 13, 2012 13:34
-
-
Save kgaughan/4065786 to your computer and use it in GitHub Desktop.
Function to get the first day of the month. Why doesn't this already exist 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
CREATE FUNCTION FIRST_DAY(dt DATE) | |
RETURNS DATE DETERMINISTIC | |
RETURN LAST_DAY(dt - INTERVAL 1 MONTH) + INTERVAL 1 DAY; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment