Re: ISO8601 vs POSIX offset clarification

From: rob stone <floriparob(at)gmail(dot)com>
To: Bharanee Rathna <deepfryed(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: ISO8601 vs POSIX offset clarification
Date: 2017-12-04 12:07:02
Message-ID: 1512389222.5095.4.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 2017-12-04 at 14:03 +1100, Bharanee Rathna wrote:
> To be more specific, I expected the output of both these queries to
> be the same.
>
> # select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at
> time zone '+11:00';
> timezone
> ---------------------
> 2017-11-30 13:00:00
>
> # select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at
> time zone 'Australia/Melbourne';
> timezone
> ---------------------
> 2017-12-01 11:00:00
>
> Cheers
>

select '2017-12-01 11:00:00 +11:00'::timestamp with time zone at time
zone INTERVAL '+11:00';

Result:-

2017-12-01 11:00:00.0

You need the INTERVAL keyword when using a numeric value instead of a
time zone name. It's in the doco.

The parser ought to throw an error, but it doesn't.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jakub Glapa 2017-12-04 12:18:38 Re: ERROR: too many dynamic shared memory segments
Previous Message Martin Moore 2017-12-04 12:03:49 Replication causing publisher node to use excessive cpu over time