Skip site navigation (1) Skip section navigation (2)

date_trunc problems crossing DST border

From: "Matthew \"Cheetah\" Gabeler-Lee" <cheetah(at)fastcat(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: date_trunc problems crossing DST border
Date: 2004-10-31 04:54:20
Message-ID: Pine.LNX.4.61.0410310044410.31259@cheetah.fastcat.org (view raw or flat)
Thread:
Lists: pgsql-bugs
[ PostgreSQL 7.4.5, Linux (Debian sarge) ]

The date_trunc function is making some off-by-one errors when working at 
a DST border.

=> select date_trunc('minute', '2004-10-31 01:00:00-05'::timestamptz);
       date_trunc       
------------------------
 2004-10-31 01:00:00-04


Expecting 2004-10-31 01:00:00-05, same error happens with minutes after 
1 am.  The timezone error also happens when truncating to minutes, 
seconds, hours.  I suspect this is happening because there are two 
01:00:00 local time this day because of the "fall back" DST switch.

-- 
	-Cheetah
"Reality is that which, when you stop believing in it, doesn't go away".
                -- Philip K. Dick
GPG pubkey fingerprint: A57F B354 FD30 A502 795B 9637 3EF1 3F22 A85E 2AD1

Responses

pgsql-bugs by date

Next:From: Sergey UshakovDate: 2004-10-31 07:00:34
Subject: Bug report for Postgresql 8.0-beta1 for WINDOWS.
Previous:From: Tom LaneDate: 2004-10-30 02:19:50
Subject: Re: could not find /usr/local/timezone

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group