Question itself was asked multiple times but I happened to come across a problem I can't fix.
I Have a table containing dates in format: Tue Jan 29 15:24:20 CET 2019 which according to fields in documentation stands for Dy Mon DD HH24:MI:SS TZ YYYY.
updated column in table is type of text
I would like to update each row and convert this date to YYYY-MM-DD HH24:MI:SS but first I want to convert the date from one format to the other however I got sql error:
select to_char(to_date(updated, 'Dy Mon DD HH24:MI:SS TZ YYYY'), 'YYYY-MM-DD HH24:MI:SS') from audit where id =1267;
ERROR: formatting field "TZ" is only supported in to_char
Can anyone give me a hint how to do so?
textorvarcharcolumns. If you had used a properdatedata type, you could simply useto_char()to display the date in any format you wish.cast(updated as timestamp)?