-
-
Save gcleaves/9df6d94ce0062c8eafb7 to your computer and use it in GitHub Desktop.
MySQL date_trunc equivalent
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
DATE_TRUNC('week', now()) === STR_TO_DATE(CONCAT(YEARWEEK(now(), 2), ' Sunday'), '%X%V %W') | |
DATE_TRUNC('month', now()) === DATE_FORMAT(now(), '%Y-%m-01') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment