note 15419 added to function.mktime

From: Date: Sun, 09 Sep 2001 23:04:41 +0000
Subject: note 15419 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-17852@lists.php.net to get a copy of this message
Do not add leading zeroes to your values calling mktime() or gmmktime()! This could cause a wrong calculation (but not in every case - that's the tricky thing).<br> e.g. try out this code:<br> echo "calc with zero: ".mktime(00,00,00,09,04,2001)."\n"; echo "calc w/o zero: ".mktime(0,0,0,9,4,2001)."\n";<br> The result will be (which should be the same values but only the second one is correct):<br> calc with zero: 975884400 calc w/o zero: 999554400<br> Tested under PHP 4.0.6 on Win32 and under PHP 4.0.6 on Linux system (kernel 2.2.20). http://www.php.net/manual/en/function.mktime.php

« previous php.notes (#17852) next »