I’m trying to parse some strings into Oracle’s TIMESTAMP WITH TIMEZONE
with to_timestamp_tz
.
The documentation suggests I should use TZD
to parse three-letter codes like PST
& PDT
. However, that doesn’t seem to work:
SELECT
to_timestamp_tz('10 Apr 2023 09:09:06 AM UTC', 'DD Mon YYYY HH:MI:SS AM TZD')
FROM
dual;
ORA-01857: not a valid time zone
I can instead use TZR
, which according to the docs should be for region information like US/Pacific
:
SELECT
to_timestamp_tz('10 Apr 2023 09:09:06 AM UTC', 'DD Mon YYYY HH:MI:SS AM TZR')
FROM
dual;
2023-04-10 09:09:06.000000000 +00:00
TZR
handles some three-letter codes but not others, however:
SELECT
to_timestamp_tz('10 Apr 2023 09:09:06 AM PST', 'DD Mon YYYY HH:MI:SS AM TZR')
FROM
dual;
2023-04-10 09:09:06.0 PST
SELECT
to_timestamp_tz('10 Apr 2023 09:09:06 AM PDT', 'DD Mon YYYY HH:MI:SS AM TZR')
FROM
dual;
ORA-01882: timezone region not found
I can’t figure out the rhyme or reason as to why some of these worksand not others.
I’m using Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
.