I haven't found a better solution. You can use explode()
, preg_match_all()
, etc.
I have a static helper function like this
class Date {
public static function ausStrToTime($str) {
$dateTokens = explode('/', $str);
return strtotime($dateTokens[1] . '/' . $dateTokens[0] . '/' . $dateTokens[2]);
}
}
There is probably a better name for that, but I use ausStrToTime()
because it works with Australian dates (which I often deal with, being an Australian). A better name would probably be the standardised name, but I'm not sure what that is.