Given a date string formatted Y-m-d
(2014-4-11
for example), how can I get a UNIX timestamp of 12am the beginning of that day? Would it involve date_parse_from_format()
?
Thanks
Given a date string formatted Y-m-d
(2014-4-11
for example), how can I get a UNIX timestamp of 12am the beginning of that day? Would it involve date_parse_from_format()
?
Thanks
You can simply use strtotime()
$date = "2014-04-11";
$timestamp = strtotime($date);
which inturm gives you -
$d = date('Y-m-d H:i:s', $timestamp); // 2014-04-11 00:00:00
Try online conversion to test - http://www.onlineconversion.com/unix_time.htm