In the end, I'm shooting for the column to have values formatted exactly like this:
2022-01-05 07:00:00.000
UTC (YYYY-MM-DD HH.MM.SS.fff UTC)
From the database we're working with, the table has two columns of interest.
- card_day which is a datetime, but the only thing we care about is the actual date. (ex:
2022-01-06 00:00:00.000
, the time is always 00:00:00.000) - l_time which is a varchar containing the hour and minute. (ex: 03:30)
I want to combine both of these into a new column with the value (using the example ^):
2022-01-06 03:30:00.000 UTC
I did find a way to do this which seems to work for now:
to_iso8601(DATE(card_day)) || ' ' || l_time || ':00.000 UTC' as crazy_formatted_timestamp,
So I'm basically just converting the pieces into strings and then concattenating everything together including hard-coding the seconds and timezone piece.
I feel like there has to be a better way, but I'm struggling to find the right way to do this with Presto SQL. Are there any minor or major improvements I can make here to clean things up?
Help would be much appreciated!