I am trying to get the timestamp of the first day of the month at 00:00:00.
For example, the timestamp of Jan 01 2012 00:00:00
I'm doing this:
$test_month = time(); // Seconds
$test_month = date('M', $test_month); // This month
$test_month = strtotime($test_month); // Timestamp of this month
echo $test_month;
This is returning zero hour of the current day of the month, not the start of the month.
Any suggestions?
Try this:
echo date( 'F jS Y h:i:s A', strtotime( 'first day of ' . date( 'F Y')));
This will output:
June 1st 2012 12:00:00 AM
echo date("Y-m-d 00:00:00", strtotime("first day of this month"));
这输出:
2017-05-01 00:00:00
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.