note 94781 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 15 Aug 2010 18:42:23 +0000 |
| Subject: | note 94781 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171710@lists.php.net to get a copy of this message | ||
Note Submitter: mohan6678 gmail.com
----
There is a date Y 0000 bug in power pc machines, which was fixed in [5.2.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.