handling totally absent dates in _strtotime, return current timestamp is all failes

This commit is contained in:
Klaus Leithoff 2010-09-06 13:04:03 +00:00
parent 126c121210
commit 8ef9570d93

View File

@ -3037,6 +3037,7 @@
}
/**
* Helper function to handle wrong or unrecognized timezones
* returns the date as it is parseable by strtotime, or current timestamp if everything failes
*/
static function _strtotime($date='')
{
@ -3044,12 +3045,13 @@
{
$dtarr = explode(' ',$date);
$test = false;
while ($test===false)
while ($test===false && count($dtarr)>=1)
{
array_pop($dtarr);
$test=strtotime(implode(' ',$dtarr));
if ($test) $date = implode(' ',$dtarr);
}
if ($test===false) $date = strtotime('now');
}
return $date;
}