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.
http://www.devart.com/forums/viewtopic.php?t=20976
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.
Thanks,
--Alan
Time zone info
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
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:
To retrieve the time zone name, you can use the following query
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());
Code: Select all
SELECT current_setting('TIMEZONE')