mktime() and the format of the day number entry
| From: | Johnson, Kirk | Date: | Thu, 02 Jan 2003 20:50:09 +0000 |
| Subject: | mktime() and the format of the day number entry | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129989@lists.php.net to get a copy of this message | ||
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."
<?
$tmp = mktime(0,0,0,10,0,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,00,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,1,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,01,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,2,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,02,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,3,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,03,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,4,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,04,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,5,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,05,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,6,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,06,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,7,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,07,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,8,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,08,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,9,1998);
echo "$tmp<br>";
$tmp = mktime(0,0,0,10,09,1998);
echo "$tmp<br>";
?>