i try this $creation = date('Y-m-d H:i:s',strtotime('25 March 2014 - 16:45'));
but it's not work
The reason your code doesn't work is because '25 March 2014 - 16:45'
is not in a format that strtotime()
can parse.
strtottime()
is good at handling a wide range of formats, but it can't cope with absolutely anything; there's just too much variation possible.
I suggest that you try PHP's DateTime
class instead. This class has a method called createFromFormat()
which allows you to specify the format of the incoming date string. This makes it easier for it to parse, and allows for formats that might not be recognised otherwise, like yours.
Try this:
$date = DateTime::createFromFormat('j F Y - H:i', '25 March 2014 - 16:45');
echo $date->format('Y-m-d H:i:s');