获取给定的一天开始的时间戳';Y-m-d';


Get timestamp of beginning of day given 'Y-m-d'

给定一个格式为Y-m-d(例如2014-4-11)的日期字符串,如何获得当天开始时的UNIX时间戳12am?会涉及date_parse_from_format()吗?

感谢

您可以简单地使用strtotime()

$date = "2014-04-11";
$timestamp = strtotime($date);

哪个插管给你

$d = date('Y-m-d H:i:s', $timestamp);  // 2014-04-11 00:00:00

尝试联机转换以测试-http://www.onlineconversion.com/unix_time.htm