Re: TimeStamp BEFORE 1970
| From: | Bruno B B Magalhães | Date: | Fri, 08 Jul 2005 00:54:38 +0000 |
| Subject: | Re: TimeStamp BEFORE 1970 | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-218325@lists.php.net to get a copy of this message | ||
Hi Folks,
Well I think I got it, at least it's working more or less to me now...
I really would appreciate any comments or suggestions.
function str2time($input = '12/31/1969')
{
if(($output = strtotime($input)) !== -1)
{
return $output;
}
else
{
preg_match('([0-2][0-9][0-9][0-9])', $input, $year);
preg_replace('([0-2][0-9][0-9][0-9])', '1976', $input);
return floor(strtotime($input) + (($year[0] - 1976) * (31557376.189582)));
}
}
Thanks a lot!
Best Regards,
Bruno B B Magalhaes