I am using postgreSQL
I am trying to convert column datetime column dtstart
(example value 2024-09-23 09:43:51.000 +0300
)
Into two columns date
in format 23.09.2024 and time
in format 09:43:51
This code is working, but format is wrong:
cast(to_char(dtstart, 'YYYY-MM-DD') as date) as "Date",
cast(to_char(dtstart, 'HH24:MI:SS') as time) as "Time",
I was trying to change format:
For cast(to_char(dtstart, 'DD.MM.YYYY') as date) as "Date",
I have an error:
ERROR: date/time field value out of range: “23.09.2024”
Hint: Perhaps you need a different “datestyle” setting.
4