RE: [PHP] php date bug ?

From: Date: Fri, 03 Aug 2001 15:46:01 +0000
Subject: RE: [PHP] php date bug ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61148@lists.php.net to get a copy of this message
I wasn't sure if mktime(0,0,0,1,32,2001) would work. BUT!!! I stand corrected. you are absolutely right. PHP is smart enough to know that January 32nd is really February first. :) Next Time I'll test the code before i respond. Johnny Nguyen -----Original Message----- From: Steve Brett [mailto:steve.brett@e-mis.com] Sent: Friday, August 03, 2001 8:33 AM To: php-general@lists.php.net Subject: Re: [PHP] php date bug ? as far as i know adding 1 day to the day value of the timestamp will increment the month as well. adding i day to july 31st will give august 1st. if you need it i'll send you my code whihc now works. i think gmmktime() would also have worked. Steve "Johnny Nguyen" <johnny@zugara.com> wrote in message news:MLEOIBNOMCMGHDKJLMCAOEALCBAA.johnny@zugara.com... > I'm in the exact same position. It's definitely not a PHP problem. > > The problem with the way you're redefining your timestamp is that you may > get January 32, June 31st, etc. > > I'm tempted to simply check for spring-forward and fallback before I advance > the timestep, but that's one extra if statement as much as 31 times in one > month. 1000 people generating the calendar would create 31000 extra if > statements, unless I get a Cache solution. There should definitely be a PHP > function for getNextDay(), but until then, I'm going to use the extra if > statement. > > regards, > Johnny Nguyen > > -----Original Message----- > From: Steve Brett [mailto:steve.brett@e-mis.com] > Sent: Friday, August 03, 2001 7:56 AM > To: php-general@lists.php.net > Subject: [PHP] php date bug ? > > > hi, > > i've got a calendar and i produce a month sort of outlook / filofax view > that shows the user's appointments for that month. > > the way i was building it was but defining ADAY in the following manner: > > define("ADAY", (60*60*24) ); > > once i'd done evrything i needed to do i incremented the timestamp for the > day by ADAY. > > all seemed ok but then one of the users pointed out that October 28th > appeared twice and then month had 32 days in for this year. > > after a bit of head scratching we realised that the clocks go forward (any > foreign readers please excuse the rediculous way the british time system > works) and technicallay i guess october 24th has 25 hours. thus the time was > incremented to a stamp within the same day. > > redfining the stamp as > > $start3=mktime(0,0,0,$dayArray[mon],$dayArray[mday]+1,$dayArray[year]); > > does work however ? > > is it php or the server that's at fault ? > > Steve > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#61148) next »