I have made many searches for a simple function to convert custom DateTime to Timestamp, But I didn't get the exact solution:
The DateTime str is:
$dt = "14-05-2015 18:21";
(Day-Month-Year Hour:Minute) (not the standard DateTime format)
Is there a simple function to convert this string to timestamp?
Thanks.
can't be simpler than:
$dt = "14-05-2015 18:21";
echo strtotime ($dt); //1431627660
If format will always be the same, you can do it like this.
$date = DateTime::createFromFormat('d-m-Y H:i', $dt);
$timestamp = $date->format('U');