Need to convert a Snowflake TIMESTAMP_TZ(9) to String format,but throwing this error
"Date '27/02/2020' is not recognized"
Tried all of these:
TO_CHAR( date, 'DD-MM-YYYY') as date,
TO_VARCHAR(date, 'DD/MM/YYYY') as date,
TO_CHAR( date, 'DD.MM.YYYY') as date,
I can reproduce the problem if I write a query like this:
select to_char(date, 'DD-MM-YYYY')
from (
select '27/02/2020'::date date
)
-- Date '27/02/2020' is not recognized
And I can fix that query with this:
select to_char(date, 'DD-MM-YYYY')
from (
select to_date('27/02/2020', 'DD/MM/YYYY') date
)
So if that's your problem, first you need to parse the dates with to_date()
in that particular format.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.