I’m trying to extract the Time zone offset from a TIMESTAMP(6) WITH TIME ZONE column. I’ll call the column ‘EVENT_DTSZ’
The values in the column ‘EVENT_DTSZ’ follows like ‘03/03/2013 8:00:00 -06:00’
I’m trying take this value in EVENT_DTSZ and then populate it into two columns, one with just the Timestamp based on 24 hour clock and the other with just the offset
i.e.
select EVENT_DTSZ
returns ‘03/03/2013 8:00:00 -06:00’
select cast(EVENT_DTSZ as varchar(19))
returns ‘2013-03-03 20:00:00’
EXTRACT(TIMEZONE_HOUR FROM EVENT_DTSZ)
returns ‘0’
select EXTRACT(TIMEZONE_HOUR FROM CAST(EVENT_DTSZ AS TIMESTAMP(6) WITH TIME ZONE ))
returns ‘0’
EXTRACT(TIMEZONE_HOUR FROM CAST('2013-04-09 10:00:00-05:00' AS TIMESTAMP(6) WITH TIME ZONE
returns ‘-5’
I think it has something to do where there being a space between the seconds and the -6:00
Any idea how I can trim that blank space from the EVENT_DTSZ’ column with it being a TIMESTAMP(6) WITH TIME ZONE datatype? Or how I can get the timezone out? Going VARCHAR <19 just gives blank zeros. i.e. +00:00 past the seconds.
Thanks,
Forums: