too long

This question already has an answer here:

I have dates in the format Y-M-D hour-minute-second 2013-09-03 12:10:28, but I need the unixtimestamp.

PHP has a slough of functions for transforming dates and times, but apprently none that can accept a date and its format and convert it into unixtime. The closest function I found was mktime(), but I would need to parse my current date into each of its components. Is there an easier way?

</div>

strtotime('2013-09-03 12:10:28');

<?php
$str = '2013-09-03 12:10:28';
echo strtotime($str);

1378228228

You may try strtotime

echo strtotime('2013-09-03 12:10:28'); // 1378210228
<?php
$date = DateTime::createFromFormat('Y-m-d H:i:s', '2013-09-03 12:10:28');
echo $date->getTimestamp();

IMHO it is better not to use strtotime() because it tries to guess a time format. I do not like any "magic" in programming.

<?php 
echo strtotime('1/1/2013');
?>

Output: 1356994800 -> Unixtimestamp

Similar Question here