Created
April 13, 2018 13:28
-
-
Save moonhouse/57ce79fefdc1ca7ce7c55e2bccd54dde to your computer and use it in GitHub Desktop.
Convert date in RFC822 format to ISO-8601 format
This file contains hidden or 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
| -- Convert date in format 31 Mar 2017 (DD mmm YYYY) to 2017-03-31 (YYYY-MM-DD) | |
| select day, substr(day,8,4) || '-' || case when instr('JanFebMarAprMayJunJulAugSepOctNovDec',substr(day,4,3)) < 27 THEN '0' ELSE '' END || cast(instr('JanFebMarAprMayJunJulAugSepOctNovDec',substr(day,4,3))/3+1 as TEXT) || '-' ||substr(day,1,2) from dfix; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment