note 94781 added to function.date
| From: | mohan6678gmail dot com at osu1 dot php dot net | Date: | Tue, 24 Nov 2009 17:40:30 +0000 |
| Subject: | note 94781 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163247@lists.php.net to get a copy of this message | ||
There is a date Y 0000 bug in power pc machines, which was fixed in 5.10(I think). But I still a bit
old php version.
I wrote this workaround using APD override_function
It uses linux date command.
<?php
override_function('date', '$format,$timestamp=0', 'return
dateFix($format,$timestamp);');
function dateFix($format,$timestamp)
{
if($timestamp == 0)
{
$timestamp = time();
}
$date = exec("php -r 'echo date($format,$timestamp);'");
$year = exec('date +"%Y"');
return str_replace('0000',$year,$date);
}
?>
Feel free to use it.
----
Server IP: 192.41.40.227
Probable Submitter: 69.67.118.12
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/94781
Del: integrated -- https://master.php.net/note/delete/94781/integrated
Del: useless -- https://master.php.net/note/delete/94781/useless
Del: bad code -- https://master.php.net/note/delete/94781/bad+code
Del: spam -- https://master.php.net/note/delete/94781/spam
Del: non-english -- https://master.php.net/note/delete/94781/non-english
Del: in docs -- https://master.php.net/note/delete/94781/in+docs
Del: other reasons-- https://master.php.net/note/delete/94781
Reject -- https://master.php.net/note/reject/94781
Search -- https://master.php.net/manage/user-notes.php