note 56440 added to function.date
| From: | Greg at osu1 dot php dot net | Date: | Fri, 02 Sep 2005 13:45:49 +0000 |
| Subject: | note 56440 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94662@lists.php.net to get a copy of this message | ||
I had a situation where I wanted to generate the name of all months from their numerical
representation in a for/loop.
To do this:
$foo being numerical representation of month (1-12)
for ($foo=1; $foo<=12; $foo++)
{
echo date("F", mktime(0, 0, 0, $foo)) ;
}
Will return name of month dependant on $foo value.
If $foo == 1, January is returned etc.
Very useful when creating select/option HTML boxes.
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56440
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56440&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56440&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56440&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56440&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56440&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56440&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56440&report=yes
Search -- http://master.php.net/manage/user-notes.php