Instantly share code, notes, and snippets.

What would you like to do?
International version of strtotime()
* Version of strtotime() that doesn't use American dates.
* `strtotime()` interprets a date with slashes as American - i.e. m/d/y. So we
* replace all slashes with dashes, to stop it from doing this.
* @author chris barnes <>
* @link
* @param string $time A date/time string.
* @param int $now Optional. The timestamp which is used as a base for the
* calculation of relative dates.
* @return string The strtotime() output.
function world_strtotime($time, $now = null) {
if (is_null($now)) {
$now = time();
$str = str_replace('/', '-', $time);
return strtotime($time, $now);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment