Difference in TO_TIMESTAMP results.

Started by Prabhat Sahuover 7 years ago3 messages
#1Prabhat Sahu
prabhat.sahu@enterprisedb.com

Hi All,

I have found below difference in TO_TIMESTAMP results.

postgres[114552]=# select to_timestamp('15-07-1984 23:30:32','dd-mm-yyyy
hh24:mi:ss');
to_timestamp
---------------------------
1984-07-15 23:30:32+05:30
(1 row)

postgres[114552]=# select to_timestamp('15-07-84 23:30:32','dd-mm-yyyy
hh24:mi:ss');
to_timestamp
------------------------------
0084-07-15 23:30:32+05:53*:28*
(1 row)

My doubt is the *":28"* in timezone part in 2nd result, is it expected ?

--

With Regards,

Prabhat Kumar Sahu
Skype ID: prabhat.sahu1984
EnterpriseDB Corporation

The Postgres Database Company

#2Alexander Korotkov
a.korotkov@postgrespro.ru
In reply to: Prabhat Sahu (#1)
Re: Difference in TO_TIMESTAMP results.

On Tue, Sep 18, 2018 at 8:44 AM Prabhat Sahu
<prabhat.sahu@enterprisedb.com> wrote:

I have found below difference in TO_TIMESTAMP results.

postgres[114552]=# select to_timestamp('15-07-1984 23:30:32','dd-mm-yyyy hh24:mi:ss');
to_timestamp
---------------------------
1984-07-15 23:30:32+05:30
(1 row)

postgres[114552]=# select to_timestamp('15-07-84 23:30:32','dd-mm-yyyy hh24:mi:ss');
to_timestamp
------------------------------
0084-07-15 23:30:32+05:53:28
(1 row)

My doubt is the ":28" in timezone part in 2nd result, is it expected ?

Hmm, that looks strange. My first idea was that it's related to
cf984672. But I found that same behavior existed before cf984672.
I'm going to investigate more on that.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

#3Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: Prabhat Sahu (#1)
Re: Difference in TO_TIMESTAMP results.

"Prabhat" == Prabhat Sahu <prabhat.sahu@enterprisedb.com> writes:

Prabhat> postgres[114552]=# select to_timestamp('15-07-84 23:30:32','dd-mm-yyyy
Prabhat> hh24:mi:ss');
Prabhat> to_timestamp
Prabhat> ------------------------------
Prabhat> 0084-07-15 23:30:32+05:53*:28*
Prabhat> (1 row)

Prabhat> My doubt is the *":28"* in timezone part in 2nd result, is it
Prabhat> expected ?

Yes, it's expected.

The timezone db as a general rule gives the actual local mean solar time
offset (down to seconds) at the reference location (Kolkata in this
case) as the UTC offset for times before the earliest historical data
known to the tzdb maintainers.

--
Andrew (irc:RhodiumToad)