Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created January 22, 2014 22:46
Show Gist options
  • Save matthewpoer/8568948 to your computer and use it in GitHub Desktop.
Save matthewpoer/8568948 to your computer and use it in GitHub Desktop.
sub some field for the date string I supplied (in both places). Copied from http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#c4985
select date_sub('2014-01-22', interval dayofweek('2014-01-22')-1 day) as week_start_sunday;
select date_sub('2014-01-22', interval dayofweek('2014-01-22')-2 day) as week_start_monday;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment