COPY format for ISO8601 date time value
Greetings,
I am trying to implement the COPY functionality where I have the input from the dates written in the ISO8601 format like: '2021-09-18T23:59:59.1234567+02:00'.
According to the docs from https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/Statements/COPY/COPYParameters.htm
When loading date/time columns, using FORMAT significantly improves load performance. COPY supports the same formats as the TO_DATE function.
I tried to match the formatting parameters for the timezone expressed as the digits (not the timezone name). Unfortunately with failure. I followed specification from
https://vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/Functions/Formatting/TemplatePatternsForDateTimeFormatting.htm
Can anyone help with the following formatting string to be aware of the timezone ?
'SELECT TO_TIMESTAMP('2021-09-18T23:59:59.1234567+02:00', 'YYYY-MM-DD HH24:MI:SS.USXYZ')'
XYZ - how to format such timezone in Vertica?
kind regards,
Kamil
Answers
Does this help with the original format?
Well -
'2021-09-18T23:59:59.1234567+02:00'
is not a literal for aTIMESTAMP
, but for aTIMESTAMP WITH TIME ZONE
, or also,TIMESTAMPTZ
.And it loads with no problem - and no necessary transformation - into a correctly defined column.
See this scenario:
On how to work with
TIMESTAMP AT TIMEZONE
, see this from the Vertica docu:https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/DataTypes/Date-Time/TIMESTAMPATTIMEZONE.htm?zoom_highlight=timestamp with time zone