Time zone info

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Posts: 1
Joined: Fri 23 Dec 2011 15:57
Location: United States

Time zone info

Post by ahenager » Fri 23 Dec 2011 16:25

I am working on converting some code from another postgres data provider to dotConnect for Postgres. This code uses information from timestamptz to determine the time zone of the postgres server.

I am aware that postgres doesn't actually store time zone information, but the code that I am modifying is working off of the offset returned by the original provider.

I found an exchange about a similar issue, below, but it is several months old and I was wondering if the answer is still the same.

This can be done by making sure that all the PG servers have the same time zone, but I also kind of hate to make this code less robust if there's some way to get at this information from the classes being returned from dotConnect.


Devart Team
Posts: 2101
Joined: Wed 02 Nov 2011 09:44

Post by Pinturiccio » Thu 29 Dec 2011 14:13

dotConnect for PostgeSQL does not have such feature as determining the time zone of the postgres server. You can use PgSqlCommand for executing the following queries:

To retrieve the TZ value as an offset from UTC, you can use the following query:

Code: Select all

SELECT age(now() at time zone 'UTC', now());
To retrieve the time zone name, you can use the following query

Code: Select all

SELECT current_setting('TIMEZONE')

Post Reply