note 111278 added to datetime.format
| From: | aaron at visistat dot com | Date: | Fri, 01 Feb 2013 17:49:55 +0000 |
| Subject: | note 111278 added to datetime.format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193484@lists.php.net to get a copy of this message | ||
Only because I ran into a PHP Fatal error: Call to undefined function date_create()
for this to work on PHP pre-5.2, here's a last_day_of_feb function that will work there:
function last_day_of_feb ($year) {
# The 0th day of a month is the same as the last day of the month before
$last_feb_str = $year . "-03-00";
$return = date('Y-m-d', strtotime($last_feb_str));
return $return;
}
echo last_day_of_feb(2012) . "\n"; # 2012-02-29
echo last_day_of_feb(2013) . "\n"; # 2013-02-28
----
Server IP: 92.48.119.85
Probable Submitter: 50.196.173.105
----
Manual Page -- http://php.net/manual/en/datetime.format.php
Edit -- https://master.php.net/note/edit/111278
Del: integrated -- https://master.php.net/note/delete/111278/integrated
Del: useless -- https://master.php.net/note/delete/111278/useless
Del: bad code -- https://master.php.net/note/delete/111278/bad+code
Del: spam -- https://master.php.net/note/delete/111278/spam
Del: non-english -- https://master.php.net/note/delete/111278/non-english
Del: in docs -- https://master.php.net/note/delete/111278/in+docs
Del: other reasons-- https://master.php.net/note/delete/111278
Reject -- https://master.php.net/note/reject/111278
Search -- https://master.php.net/manage/user-notes.php