Re: time with timezone for PostgreSql

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: avpro avpro <avprowebeden(at)gmail(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: time with timezone for PostgreSql
Date: 2014-01-28 18:26:28
Message-ID: 52E7F654.7010904@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 01/28/2014 10:00 AM, avpro avpro wrote:
> hi,
>
> I'm using Qt 5.2 to design my application and PostgreSql for my database.
>
> i would like to find a way to insert in Qt in a QTimeEdit or a
> QLineEdit field the value of time with time zone as required by
> PostgreSql data type: time with time zone, meaning
>
> 12:45:30+01, +01 being the UTC+1.
>
> could you give me some guideline where to start from?
> thank you.
> john

Start here:
http://www.postgresql.org/docs/current/static/datatype-datetime.html

But pay attention to the comments under 8.5.3, especially "We do not
recommend using the type time with time zone":

PostgreSQL endeavors to be compatible with the SQL standard definitions
for typical usage. However, the SQL standard has an odd mix of date and
time types and capabilities. Two obvious problems are:

*

Although the date type cannot have an associated time zone, the time
type can. Time zones in the real world have little meaning unless
associated with a date as well as a time, since the offset can vary
through the year with daylight-saving time boundaries.

*

The default time zone is specified as a constant numeric offset from
UTC. It is therefore impossible to adapt to daylight-saving time
when doing date/time arithmetic across DST boundaries.

To address these difficulties, we recommend using date/time types that
contain both date and time when using time zones. We do not recommend
using the type time with time zone (though it is supported by PostgreSQL
for legacy applications and for compliance with the SQL standard).
PostgreSQL assumes your local time zone for any type containing only
date or time.

Cheers,
Steve

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message csmtcy 2014-01-28 18:38:20 Couldn't get the database from heroku
Previous Message Erik Darling 2014-01-28 18:25:41 Re: Update with last known location?