Re: Is this a bug? : select '26/10/2003'::date + interval

From: Conxita Marín <comarin(at)telefonica(dot)net>
To: "Pgsql-General-post (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is this a bug? : select '26/10/2003'::date + interval
Date: 2003-05-23 07:34:51
Message-ID: 003801c320fd$cc7c0380$0cd8a8c0@dims
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks all for your responses.

That is, Oct 26 is a daylight savings transition day im my area. Postgres
interpret interval '1 day' equal to 24 hours and Oct 26 day has 25 hours, so
the day doesn't change.

To add exactly 1 day to any date I do this, such as Tom Lane suggests:

s001=> select '26/10/2003'::date + 1;
?column?
------------
27/10/2003
(1 row)

Regards,

Conxita

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Stephan Szabo
Sent: jueves, 22 de mayo de 2003 18:13
To: cmarin(at)dims(dot)com
Cc: Pgsql-General-post (E-mail)
Subject: Re: [GENERAL] Is this a bug? : select '26/10/2003'::date +
interval

s001=> select '26/10/2003'::date + 1;
?column?
------------
27/10/2003
(1 row)

On Thu, 22 May 2003, [iso-8859-1] Conxita Marín wrote:

> Hi.
>
> Is this a bug?
>
> s001=> select '25/10/2003'::date + interval '1 day';
> ?column?
> --------------------------
> 26/10/2003 00:00:00 CEST
> (1 row)
>
> s001=> select '26/10/2003'::date + interval '1 day';
> ?column?
> -------------------------
> 26/10/2003 23:00:00 CET (????)
> (1 row)

Is that your daylight savings time changeover point (appears to be from
the output, but it's worth checking). IIRC '1 day' is taken as equivalent
to 24 hours which because of the time zone switch causes the above (it'd
presumably be 27/10/2003 00:00:00 CEST but that's not your timezone
anymore).

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-05-23 08:21:32 [Pgsql-ayuda] Re: [GENERAL] Tool for BackUp
Previous Message Stephan Szabo 2003-05-23 06:46:35 Re: deadlocks problem