The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now!
A chart showing the TIBCO Platform vision
Jump to content
Forums
Ask questions and gain insight from discussions

How to convert an unsupported MSSQL datetimeoffset value at time zone 'Europe/Amsterdam' to a timestamp at time zone UTC?


Alban Hertroys 2

Recommended Posts

We have several source tables with datetimeoffsets, where DST changes cause times between 2:00 and 3:00 am to either overlap or be missing if converted to a timestamp. Hence, we need the base views in TDV to have this value available at UTC, where the times are continuous and non-ambiguous.

Link to comment
Share on other sites

I currently use this procedure to accomplish this, but it doesn't look very efficient... Suggestions for improvement (or for a more direct conversion) are still very much appreciated.

PROCEDURE DateTimeOffset_to_UTC( IN AmsDTOffset VARCHAR(37), OUT UTCTimestamp TIMESTAMP)BEGIN SELECT TIMESTAMPADD(SQL_TSI_hour , CAST(CASE SUBSTRING(AmsDTOffset, 29, 1) WHEN '+' THEN -1 ELSE +1 END * HOUR(CAST(CONCAT(RIGHT(AmsDTOffset, 5), ':00') as TIME)) as INTEGER) , CAST(LEFT(AmsDTOffset, 26) as TIMESTAMP) ) AS x INTO UTCTimestamp FROM (SELECT 1 as x) dual ;END
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...