note 37413 added to function.date
| From: | endofyourself at yahoo dot com | Date: | Fri, 14 Nov 2003 07:47:05 +0000 |
| Subject: | note 37413 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60367@lists.php.net to get a copy of this message | ||
I know this seems totally obvious, but for any newbies...
If you are doing something along the lines of:
<?
echo date( "y" , mktime( 0 , 0 , 0 , 0 , 0 , 2003 ))
?>
and it is returning "02" instead of "03", do this:
<?
echo date( "y" , mktime( 0 , 0 , 0 , (int)date( "n" ) , (int)date( "j"
) , 2003 ))
?>
The reason for this is that the 0 day of the 0 month of the year 2003 is actually the last day of
the last month of 2002 technically speaking.
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37413
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37413&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37413&report=yes
Search -- http://master.php.net/manage/user-notes.php