I'm having a date format of Jun 26, '12
.
strtotime()
converts proper date string, and this string results in a blank output.
This can be solved but I can only think of ugly ways of doing it.
Any ideas for converting this date format to UNIX timestamp elegantly?
How about this strtotime('Jun 26,12');
I used DateTime::createFromFormat
works well for me.. more info here.
Um, s/'/20/g'
? Followed by strtotime()
?
Maybe something like this?
$string = 'April 26,\'12';
echo strtotime(preg_replace('/(\w+) (\d+),\'(\d+)/i', '$2 $1 20$3', $string));
Based on example from php.net