Posted: Wed Apr 15, 2015 8:54 am Post subject: insert timestamp with timezone
Newbie
Joined: 13 Mar 2015 Posts: 8
Hi.
I need to insert a timestamp with timezone(
2000-12-12T10:45:34.100-06:00)into a sql Server database with data type datetimeoffset(7).When i cast it to timestamp with format yyyy-MM-ddTHH:mm:ssSSSZZZ it inserts a wrong timestamp to database (like with a timestamp one hour more than input.But i want same timestamp as the input.How to do this?
Posted: Wed Apr 15, 2015 9:07 am Post subject: Re: insert timestamp with timezone
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
kiranshet89 wrote:
(like with a timestamp one hour more than input.But i want same timestamp as the input.
This sounds a lot like a problem with daylight savings settings. What are the relevant settings for the 2 servers in question? _________________ Honesty is the best policy.
Insanity is the best defence.
Posted: Wed Apr 15, 2015 10:32 am Post subject: Re: insert timestamp with timezone
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
kiranshet89 wrote:
Hi.
I need to insert a timestamp with timezone(
2000-12-12T10:45:34.100-06:00)into a sql Server database with data type datetimeoffset(7).When i cast it to timestamp with format yyyy-MM-ddTHH:mm:ssSSSZZZ it inserts a wrong timestamp to database (like with a timestamp one hour more than input.But i want same timestamp as the input.How to do this?
OK so let's get the terminology right. Let's understand what the timestamp is before the cast. And please specify the version of the IIB or WMB including fixpack.
When having to switch timezones, I like to do it using Java only. IIRC ESQL may not always consider the date and time and just apply the current time offset... So if your date was outside of Daylight Saving(s) and you cast it today you might be one hour off. And please remember that SimpleDateFormat is not threadsafe...
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum