Incrementing with DateTime
I stumbled upon a strange occurrence when I incrementally add days using the DateTime function. For some reason, on Sunday October 27 (it has to be a Sunday) of any given year, when I try to add a day to it, it only adds 23 hours instead of 24...causing the day to still be the 27th (with 23 hours added). Here is printed loop to illustrate what I'm talking about: 2002/10/11 00:00:01 US/Mountain 2002/10/12 00:00:01 US/Mountain 2002/10/13 00:00:01 US/Mountain 2002/10/14 00:00:01 US/Mountain 2002/10/15 00:00:01 US/Mountain 2002/10/16 00:00:01 US/Mountain 2002/10/17 00:00:01 US/Mountain 2002/10/18 00:00:01 US/Mountain 2002/10/19 00:00:01 US/Mountain 2002/10/20 00:00:01 US/Mountain 2002/10/21 00:00:01 US/Mountain 2002/10/22 00:00:01 US/Mountain 2002/10/23 00:00:01 US/Mountain 2002/10/24 00:00:01 US/Mountain 2002/10/25 00:00:01 US/Mountain 2002/10/26 00:00:01 US/Mountain 2002/10/27 00:00:01 US/Mountain 2002/10/27 23:00:01 US/Mountain 2002/10/28 23:00:01 US/Mountain 2002/10/29 23:00:01 US/Mountain 2002/10/30 23:00:01 US/Mountain 2002/10/31 23:00:01 US/Mountain This seems to happen on the last Sunday in October of any year. Weird. Any input on this would help me out. --colyn
On Tue, Oct 22, 2002 at 03:28:01PM -0700, Colyn Brown wrote: | I stumbled upon a strange occurrence when I incrementally add days | using the DateTime function. For some reason, on Sunday October 27 (it | has to be a Sunday) of any given year, when I try to add a day to it, | it only adds 23 hours instead of 24...causing the day to still be the | 27th (with 23 hours added). Here is printed loop to illustrate what | I'm talking about: <snip> | This seems to happen on the last Sunday in October of any year. Weird. | Any input on this would help me out. Seems to be the 'Daylight Savings Time'. []'s -- Sidnei da Silva (dreamcatcher) <sidnei@x3ng.com.br> X3ng Web Technology <http://www.x3ng.com.br> GNU/Linux user 257852 Debian GNU/Linux 3.0 (Sid) 2.4.18 ppc You had mail, but the super-user read it, and deleted it!
Sounds like a bug. File a collector issue, assuming there isn't one already.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Colyn Brown Sent: Tuesday, October 22, 2002 3:28 PM To: zope@zope.org Subject: [Zope] Incrementing with DateTime
I stumbled upon a strange occurrence when I incrementally add days using the DateTime function. For some reason, on Sunday October 27 (it has to be a Sunday) of any given year, when I try to add a day to it, it only adds 23 hours instead of 24...causing the day to still be the 27th (with 23 hours added). Here is printed loop to illustrate what I'm talking about:
2002/10/11 00:00:01 US/Mountain 2002/10/12 00:00:01 US/Mountain 2002/10/13 00:00:01 US/Mountain 2002/10/14 00:00:01 US/Mountain 2002/10/15 00:00:01 US/Mountain 2002/10/16 00:00:01 US/Mountain 2002/10/17 00:00:01 US/Mountain 2002/10/18 00:00:01 US/Mountain 2002/10/19 00:00:01 US/Mountain 2002/10/20 00:00:01 US/Mountain 2002/10/21 00:00:01 US/Mountain 2002/10/22 00:00:01 US/Mountain 2002/10/23 00:00:01 US/Mountain 2002/10/24 00:00:01 US/Mountain 2002/10/25 00:00:01 US/Mountain 2002/10/26 00:00:01 US/Mountain 2002/10/27 00:00:01 US/Mountain 2002/10/27 23:00:01 US/Mountain 2002/10/28 23:00:01 US/Mountain 2002/10/29 23:00:01 US/Mountain 2002/10/30 23:00:01 US/Mountain 2002/10/31 23:00:01 US/Mountain
This seems to happen on the last Sunday in October of any year. Weird. Any input on this would help me out.
--colyn
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Am 23.10.2002, 00:52 Uhr schrab Charlie Reiman <creiman@kefta.com>:
Sounds like a bug. File a collector issue, assuming there isn't one already.
Dunno. Since an online calendaring system we use and which is based on php shows strange behaviour around that date as well my guess would be that this is a bug in some library both systems use (libc perhaps?). Just a wild guess without any proper research. Jo. -- Internetmanufaktur Jo Meder ---------------------- Berlin, Germany http://www.meder.de/ ------------------- fon: ++49-30-417 17 63 33 Kollwitzstr. 75 ------------------------ fax: ++49-30-417 17 63 45 10435 Berlin --------------------------- mob: ++49-170- 2 98 89 97 Public GnuPG-Key ---------- http://www.meder.de/keys/jo-pubkey.txt
Thanks to Sidnei da Silva <sidnei@x3ng.com>. He tells me it has something to do with daylight savings time. If that were true than on April 8, an hour should be added instead of subtracted. I tested that and it's true. 25 hours gets added to April 7th (a day + an hour), which gives me 2002/04/08 01:00:01 US/Mountain --colyn
From: "Charlie Reiman" <creiman@kefta.com> Date: Tue, 22 Oct 2002 15:52:57 -0700 To: "Colyn Brown" <colyn.brown@newtimes.com>, <zope@zope.org> Subject: RE: [Zope] Incrementing with DateTime
Sounds like a bug. File a collector issue, assuming there isn't one already.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Colyn Brown Sent: Tuesday, October 22, 2002 3:28 PM To: zope@zope.org Subject: [Zope] Incrementing with DateTime
I stumbled upon a strange occurrence when I incrementally add days using the DateTime function. For some reason, on Sunday October 27 (it has to be a Sunday) of any given year, when I try to add a day to it, it only adds 23 hours instead of 24...causing the day to still be the 27th (with 23 hours added). Here is printed loop to illustrate what I'm talking about:
2002/10/11 00:00:01 US/Mountain 2002/10/12 00:00:01 US/Mountain 2002/10/13 00:00:01 US/Mountain 2002/10/14 00:00:01 US/Mountain 2002/10/15 00:00:01 US/Mountain 2002/10/16 00:00:01 US/Mountain 2002/10/17 00:00:01 US/Mountain 2002/10/18 00:00:01 US/Mountain 2002/10/19 00:00:01 US/Mountain 2002/10/20 00:00:01 US/Mountain 2002/10/21 00:00:01 US/Mountain 2002/10/22 00:00:01 US/Mountain 2002/10/23 00:00:01 US/Mountain 2002/10/24 00:00:01 US/Mountain 2002/10/25 00:00:01 US/Mountain 2002/10/26 00:00:01 US/Mountain 2002/10/27 00:00:01 US/Mountain 2002/10/27 23:00:01 US/Mountain 2002/10/28 23:00:01 US/Mountain 2002/10/29 23:00:01 US/Mountain 2002/10/30 23:00:01 US/Mountain 2002/10/31 23:00:01 US/Mountain
This seems to happen on the last Sunday in October of any year. Weird. Any input on this would help me out.
--colyn
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On a side note, the INCREMENT 1 DAY function in mySQL worked better for me with no doubling days. --colyn
From: "Charlie Reiman" <creiman@kefta.com> Date: Tue, 22 Oct 2002 15:52:57 -0700 To: "Colyn Brown" <colyn.brown@newtimes.com>, <zope@zope.org> Subject: RE: [Zope] Incrementing with DateTime
Sounds like a bug. File a collector issue, assuming there isn't one already.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Colyn Brown Sent: Tuesday, October 22, 2002 3:28 PM To: zope@zope.org Subject: [Zope] Incrementing with DateTime
I stumbled upon a strange occurrence when I incrementally add days using the DateTime function. For some reason, on Sunday October 27 (it has to be a Sunday) of any given year, when I try to add a day to it, it only adds 23 hours instead of 24...causing the day to still be the 27th (with 23 hours added). Here is printed loop to illustrate what I'm talking about:
2002/10/11 00:00:01 US/Mountain 2002/10/12 00:00:01 US/Mountain 2002/10/13 00:00:01 US/Mountain 2002/10/14 00:00:01 US/Mountain 2002/10/15 00:00:01 US/Mountain 2002/10/16 00:00:01 US/Mountain 2002/10/17 00:00:01 US/Mountain 2002/10/18 00:00:01 US/Mountain 2002/10/19 00:00:01 US/Mountain 2002/10/20 00:00:01 US/Mountain 2002/10/21 00:00:01 US/Mountain 2002/10/22 00:00:01 US/Mountain 2002/10/23 00:00:01 US/Mountain 2002/10/24 00:00:01 US/Mountain 2002/10/25 00:00:01 US/Mountain 2002/10/26 00:00:01 US/Mountain 2002/10/27 00:00:01 US/Mountain 2002/10/27 23:00:01 US/Mountain 2002/10/28 23:00:01 US/Mountain 2002/10/29 23:00:01 US/Mountain 2002/10/30 23:00:01 US/Mountain 2002/10/31 23:00:01 US/Mountain
This seems to happen on the last Sunday in October of any year. Weird. Any input on this would help me out.
--colyn
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Colyn, looks like the "day savings" as I think this is called. This must happen twice a year were the clocks are rewind and forward 1 hour in most regions. And yes, this is always from saturday to sunday to avoid further confusion :) HTH Tino Wildenhain --On Dienstag, 22. Oktober 2002 15:28 -0700 Colyn Brown <colyn.brown@newtimes.com> wrote:
I stumbled upon a strange occurrence when I incrementally add days using the DateTime function. For some reason, on Sunday October 27 (it has to be a Sunday) of any given year, when I try to add a day to it, it only adds 23 hours instead of 24...causing the day to still be the 27th (with 23 hours added). Here is printed loop to illustrate what I'm talking about:
2002/10/11 00:00:01 US/Mountain 2002/10/12 00:00:01 US/Mountain 2002/10/13 00:00:01 US/Mountain 2002/10/14 00:00:01 US/Mountain 2002/10/15 00:00:01 US/Mountain 2002/10/16 00:00:01 US/Mountain 2002/10/17 00:00:01 US/Mountain 2002/10/18 00:00:01 US/Mountain 2002/10/19 00:00:01 US/Mountain 2002/10/20 00:00:01 US/Mountain 2002/10/21 00:00:01 US/Mountain 2002/10/22 00:00:01 US/Mountain 2002/10/23 00:00:01 US/Mountain 2002/10/24 00:00:01 US/Mountain 2002/10/25 00:00:01 US/Mountain 2002/10/26 00:00:01 US/Mountain 2002/10/27 00:00:01 US/Mountain 2002/10/27 23:00:01 US/Mountain 2002/10/28 23:00:01 US/Mountain 2002/10/29 23:00:01 US/Mountain 2002/10/30 23:00:01 US/Mountain 2002/10/31 23:00:01 US/Mountain
This seems to happen on the last Sunday in October of any year. Weird. Any input on this would help me out.
--colyn
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
At 3:28 PM -0700 10/22/02, Colyn Brown wrote:
I stumbled upon a strange occurrence when I incrementally add days using the DateTime function. For some reason, on Sunday October 27 (it has to be a Sunday) of any given year, when I try to add a day to it, it only adds 23 hours instead of 24...causing the day to still be the 27th (with 23 hours added). Here is printed loop to illustrate what I'm talking about:
2002/10/11 00:00:01 US/Mountain 2002/10/12 00:00:01 US/Mountain 2002/10/13 00:00:01 US/Mountain 2002/10/14 00:00:01 US/Mountain 2002/10/15 00:00:01 US/Mountain 2002/10/16 00:00:01 US/Mountain 2002/10/17 00:00:01 US/Mountain 2002/10/18 00:00:01 US/Mountain 2002/10/19 00:00:01 US/Mountain 2002/10/20 00:00:01 US/Mountain 2002/10/21 00:00:01 US/Mountain 2002/10/22 00:00:01 US/Mountain 2002/10/23 00:00:01 US/Mountain 2002/10/24 00:00:01 US/Mountain 2002/10/25 00:00:01 US/Mountain 2002/10/26 00:00:01 US/Mountain 2002/10/27 00:00:01 US/Mountain 2002/10/27 23:00:01 US/Mountain 2002/10/28 23:00:01 US/Mountain 2002/10/29 23:00:01 US/Mountain 2002/10/30 23:00:01 US/Mountain 2002/10/31 23:00:01 US/Mountain
This seems to happen on the last Sunday in October of any year. Weird. Any input on this would help me out.
This is correct behavior as this is the change from Daylight Savings Time in the US (first Sunday in April, last Sunday in October). What is really happening is that the date has an underlying representation (say) of days since an epoch (usually 1/1/1970) in a particular time zone (usually UCT). When you add one to this it moves to the next day in that representation. But you are not displaying this underlying representation, you are displaying the /interpretation/ of that representation in a particular time zone. If you set the time zone to UCT (or any zone without DST e.g. US/Hawaii), you would see the behavior you expect. HTH, Sincerely, Richard Wesley Co-President, Electric Fish, Inc. <http://www.electricfish.com/> (v) +1-206-493-1690x210 (f) +1-206-493-1697
participants (6)
-
Charlie Reiman -
Colyn Brown -
Jo Meder -
Richard Wesley -
Sidnei da Silva -
Tino Wildenhain