GetDateTimeOffset exception around DST change

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Nieuwsma
Posts: 9
Joined: Wed 05 May 2010 16:30

GetDateTimeOffset exception around DST change

Post by Nieuwsma » Tue 07 May 2013 23:36

In our Postgres db we have a field defined as:
samples_timestamp timestamp with time zone NOT NULL
Our code reads records from one db and writes a copy of it to another db. These databases can be in different time zones, so we use the PgSqlDataReader and GetDateTimeOffset to ensure we can correctly assign the time offset when we build the SQL insert statement. This works correctly except when the timestamp is within a few hours of the Daylight Saving Time (DST) change. Then the call to GetDateTimeOffset throws an exception. We are in Pacific time so the pre-DST offset is -08.
Example timestamp: "2013-03-09 19:50:00.02-08"
Here is the exception:
The UTC Offset of the local dateTime parameter does not match the offset argument. Parameter name: offset
at System.DateTimeOffset..ctor(DateTime dateTime, TimeSpan offset)
at Devart.Data.PostgreSql.j.ba(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.PostgreSql.PgSqlDataReader.GetDateTimeOffset(Int32 i)
Please advise if there is a workaround and if this will be fixed. We are using version 6.2.122 and I have also tried using 6.6.226 and it also fails. Our db is Postgres 9.1.9.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: GetDateTimeOffset exception around DST change

Post by Pinturiccio » Thu 16 May 2013 12:02

We have reproduced and fixed the bug with the PgSqlDataReader.GetDateTimeOffset method when reading data of the timestamp with time zone type. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

You can also use the GetPgSqlTimeStamp method of the PgSqlReader object for reading data of the 'timestamp with time zone' type. For more information, please refer to our documentation

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: GetDateTimeOffset exception around DST change

Post by Pinturiccio » Mon 20 May 2013 08:29

The new build of dotConnect for PostgreSQL 6.6.242 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=27134

Post Reply