Home:ALL Converter>Question about Postgres/Redshift date formatting

Question about Postgres/Redshift date formatting

Ask Time:2020-09-23T02:53:10         Author:Thomas Stevens

Json Formatter

One of the data sources we have coming into our Redshift, is MySQL and all the date formatting is 'YYYY-MM-DD'. When querying, this gives me a bunch of issue, especially when I have to make reoccurring reporting for it etc. I tried converting it to 'YYYY/MM/DD', but it complicates it especially when altering the date (timezone, trunc). Currently to cover reoccurring reporting I found TRUNC(timestamp) = DATE(DATEADD(DAY, -1, GETDATE())). I was hoping there was a better way to deal with this and this format of dates. I know this is an ambiguous question, but ultimately I am looking for a better way to handle this date formatting.

Author:Thomas Stevens,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/64016048/question-about-postgres-redshift-date-formatting
yy