note 97195 deleted from function.strtotime by derick
| From: | derick@php.net | Date: | Sun, 03 Nov 2013 15:21:20 +0000 |
| Subject: | note 97195 deleted from function.strtotime by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197409@lists.php.net to get a copy of this message | ||
Note Submitter: nparslow at gmail dot com
----
Here is a basic example of a version that works for people outside of the US:
<?php
function strtotime_nonus($date)
{
if(is_null($date) or ($date == ""))
return False;
// break out components with '/', maximum of 3 elements
$components = explode("/", $date, 3);
$count = count($components);
if($count > 1) // There is a slash
{
$tmp = $components[0]; // Swap first and second components
$components[0] = $components[1];
$components[1] = $tmp;
}
return strtotime(implode("/",$components)); // Put back together
}
?>