PHP Code:
<?php
$strings = array(
'Dresden Dolls Space Gallery Portland Oregon 06-02-2005',
'Dead Weather House Of Blues Boston 18/07/2009',
'Dirty Fuzz Harmonie Bonn 23.03.2007'
);
foreach($strings as $string){
$timestamp = strtotime(
vsprintf(
'%s-%s-%s',
preg_split(
'~[-./]~',
end(
explode(
' ',
$string
)
)
)
)
);
echo date('r', $timestamp), '<br />';
}
/*
Sun, 06 Feb 2005 00:00:00 +0000
Sat, 18 Jul 2009 00:00:00 +0100
Fri, 23 Mar 2007 00:00:00 +0000
*/
?>
It works, but there are an awful lot of assumptions there. You would, IMHO, be better looking at using a Regular Expression to obtain the string/date.
Bookmarks