note 94781 modified in function.date by danbrown
| From: | danbrown@php.net | Date: | Tue, 24 Nov 2009 17:50:58 +0000 |
| Subject: | note 94781 modified in function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163248@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.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.
--was--
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.
http://php.net/manual/en/function.date.php