I’m trying to find the format yyyy-mm-dd with zero seconds (the time, when the date changes) for time() function. So, for today that would be “2012-06-07 00:00:00”.
Seems like everything is clear, but
$today_starts_str='2012-06-07 00:00:00';
var_dump($today_starts_str); //'2012-06-07 00:00:00', good
$today_starts_sec=strtotime ( $today_starts_str );
var_dump($today_starts_sec); //1339016400, good
$today_starts_str2=date ( 'Y-m-d h:m:s', $today_starts_sec );
var_dump($today_starts_str2); //"2012-06-07 12:06:00" Why it is 12:06, but not 00:00?
So, i need something to get a time when the date changes for any time (probably using time());
The
minside a date format string is for the month, useifor the minutes 😉And for 24-hour format of an hour, use
Hinstead ofh. (Thanks Emil!)