Created
February 12, 2016 17:41
-
-
Save nomeyer/1aaf0aef1a86af2dcf8a to your computer and use it in GitHub Desktop.
PostgreSQL syntax to add the day to a date column
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
case extract(isodow from ~~date~~) | |
when 1 then 'Mon ' || cast(~~date~~ as date) | |
when 2 then 'Tue ' || cast(~~date~~ as date) | |
when 3 then 'Wed ' || cast(~~date~~ as date) | |
when 4 then 'Thu ' || cast(~~date~~ as date) | |
when 5 then 'Fri ' || cast(~~date~~ as date) | |
when 6 then 'Sat ' || cast(~~date~~ as date) | |
when 7 then 'Sun ' || cast(~~date~~ as date) | |
end date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment