RE: [PHP] php's 27/10/2002 problem Important

From: Date: Mon, 16 Sep 2002 14:11:25 +0000
Subject: RE: [PHP] php's 27/10/2002 problem Important
Groups: php.general 
Request: Send a blank email to php-general+get-116524@lists.php.net to get a copy of this message
I think you misunderstand - this iteration will work happily if you use this: $timestamp = mktime (6,0,0,10,25,2002) When you cross the DST barrier - the adding 86400 seconds you do to iterate will simply make the time 5am instead of 6am. Make sense? Michael. -----Original Message----- From: Mahmut Kursun [mailto:kursun@bridea.com] Sent: 16 September 2002 15:05 To: Michael Hazelden; php-general@lists.php.net Subject: Re: [PHP] php's 27/10/2002 problem Important Thank you for your reply, but unfortunately I could not get an important point. I am trying to enumerate x days in a row. So this daylight savings time will be exceptions in the code. Is there any other safe! way to enumarate x days in a row. Thanks in advance Michael Hazelden wrote: > Mahmut, > > the 27th is the day that daylight savings time ends in both the UK and the > USA. > > You will find two timestamps because on that day there will in fact be 86760 > seconds in the day not 86400. I find that using 6am as your timing point > (not midnight) will combat this problem. > > Michael. > > -----Original Message----- > From: Mahmut Kursun [mailto:kursun@bridea.com] > Sent: 16 September 2002 14:32 > To: php forum > Subject: [PHP] php's 27/10/2002 problem Important > > > If you are trying to code a sequantial date requiring algorithm you will > see that for 27/10/2002 you have two timestamps!!!! > > And that is a serious bug I think. Any comments! > > timestamp : formatted date (d/m/Y) > 1035666000 : 27/10/2002 > 1035752400 : 27/10/2002 > > P.S. To be able to generate the same output have the following code snippet: > > <? > $timestamp = mktime (0,0,0,10,25,2002); > echo "start date is"; > echo $timestamp . " : " . strftime('%d/%m/%Y', $timestamp ) . > "<br>"; > echo "<br>"; > echo "&nbsp;&nbsp;timestamp : formatted date"; > echo "<br>"; > for ($x=1; $x<10; $x++){ > $timestamp = $timestamp + 24*60*60; > echo $timestamp . " : " . strftime('%d/%m/%Y', $timestamp ) . > "<br>"; > echo $timestamp . " : " . date('d/m/Y', $timestamp ) . > "<br>"; > echo "<br>"; > } > ?> > > > > _____________________________________________________________________ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. This message has been checked for all known viruses by the MessageLabs Virus Control Centre. ********************************************************************* Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY *********************************************************************

« previous php.general (#116524) next »