RE: [PHP] mktime() and the format of the day number entry

From: Date: Thu, 02 Jan 2003 23:29:06 +0000
Subject: RE: [PHP] mktime() and the format of the day number entry
Groups: php.general 
Request: Send a blank email to php-general+get-130010@lists.php.net to get a copy of this message
The month behaves the same: both '08' and '09' are treated as zero by mktime(). Kirk > -----Original Message----- > From: Paul Roberts [mailto:mail@paul-roberts.com] > Sent: Thursday, January 02, 2003 4:24 PM > To: Johnson, Kirk > Cc: php-general@lists.php.net > Subject: Re: [PHP] mktime() and the format of the day number entry > > > same here win 2K apache php4.21 > > output > > 0,0,0,10,0,1998 => 907110000 > 0,0,0,10,00,1998 => 907110000 > 0,0,0,10,1,1998 => 907196400 > 0,0,0,10,01,1998 => 907196400 > 0,0,0,10,2,1998 => 907282800 > 0,0,0,10,02,1998 => 907282800 > 0,0,0,10,3,1998 => 907369200 > 0,0,0,10,03,1998 => 907369200 > 0,0,0,10,4,1998 => 907455600 > 0,0,0,10,04,1998 => 907455600 > 0,0,0,10,5,1998 => 907542000 > 0,0,0,10,05,1998 => 907542000 > 0,0,0,10,6,1998 => 907628400 > 0,0,0,10,06,1998 => 907628400 > 0,0,0,10,7,1998 => 907714800 > 0,0,0,10,07,1998 => 907714800 > 0,0,0,10,8,1998 => 907801200 > 0,0,0,10,08,1998 => 907110000 > 0,0,0,10,9,1998 => 907887600 > 0,0,0,10,09,1998 => 907110000 > > code > <?php > $tmp = mktime(0,0,0,10,0,1998); > echo "0,0,0,10,0,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,00,1998); > echo "0,0,0,10,00,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,1,1998); > echo "0,0,0,10,1,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,01,1998); > echo "0,0,0,10,01,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,2,1998); > echo "0,0,0,10,2,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,02,1998); > echo "0,0,0,10,02,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,3,1998); > echo "0,0,0,10,3,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,03,1998); > echo "0,0,0,10,03,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,4,1998); > echo "0,0,0,10,4,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,04,1998); > echo "0,0,0,10,04,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,5,1998); > echo "0,0,0,10,5,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,05,1998); > echo "0,0,0,10,05,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,6,1998); > echo "0,0,0,10,6,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,06,1998); > echo "0,0,0,10,06,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,7,1998); > echo "0,0,0,10,7,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,07,1998); > echo "0,0,0,10,07,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,8,1998); > echo "0,0,0,10,8,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,08,1998); > echo "0,0,0,10,08,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,9,1998); > echo "0,0,0,10,9,1998 => $tmp<br>"; > $tmp = mktime(0,0,0,10,09,1998); > echo "0,0,0,10,09,1998 => $tmp<br>"; > ?> > > > ----- Original Message ----- > From: "Johnson, Kirk" <kjohnson@zootweb.com> > To: <php-general@lists.php.net> > Sent: Thursday, January 02, 2003 8:50 PM > Subject: [PHP] mktime() and the format of the day number entry > > > > OK, I am mktime() challenged. Can someone please explain > these results to > me? > > I have some test dates in October of 1998. For the days numbered 1-7, > mktime() does not care whether I have a leading zero on the > day or not, I > get the same timestamp regardless, e.g., both a '7' and a > '07' for the day > number give the same timestamp. However, for the days 8-9, I > get different > timestamps for each if I use '8' versus '08' and '9' versus > '09'. In these > latter two cases, mktime treats both '08' and '09' as '0', > and it gives the > same timestamp as Oct 0 1998. What's up? > > The code is below if you want to have a look. > > Kirk > > Kirk Johnson > kjohnson@zootweb.com > > "0, as a number, is just as important as any other number."

« previous php.general (#130010) next »