Re: [HACKERS] What's happened with 1942

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "jose' soares" <sferac(at)bo(dot)nettuno(dot)it>
Cc: hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] What's happened with 1942
Date: 1999-03-08 15:32:04
Message-ID: 6368.920907124@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"jose' soares" <sferac(at)bo(dot)nettuno(dot)it> writes:
> prova=> select date '1941-01-01' + interval '1 year';
> ?column?
> ----------------------
> 1942-01-01 00:00:00+02
> (1 row)

> prova=> select date '1942-01-01' + interval '1 year';
> ?column?
> ----------------------
> 1942-12-31 23:00:00+01 <---------????????????????
> (1 row)

Note the transition from timezone "+02" to "+01" above. You're probably
looking at an artifact of the year-round daylight savings time that (IIRC)
some nations used during the war. Or at least some kind of change in
local timezone or DST rules that year.

Thomas would have a better idea about this than I do, but I'm betting that
the date-plus-interval operator thinks that a "one year" interval means
"365 (or 366 in leap year) times 24 hours", rather than "same local time
on the same nominal date next year". I seem to recall discussions about
exactly what "date plus 1 day" means when crossing a daylight-savings-time
boundary, for example.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1999-03-08 16:50:24 Niladic functions
Previous Message Tom Lane 1999-03-08 15:21:29 Re: [HACKERS] Timespan_div misbehaving?