I would like to display today's date as the number of ms since epoch
I know that I can use
microtime(true) / 1000
to so so, but I would like to strip the hour, minutes, ms from this result. I would like to get 2016/01/28 00:00:00 in ms. Of course this is an example, as I want the date to be the current day. Any idea on how to do so in PHP ?
How about simply
echo sprintf('%d',strtotime('midnight'));
$midnight_lastnight=strtotime('midnight - 24hours');
$midnight_tonight=strtotime('midnight');
$midnight_tomorrow=strtotime('midnight + 24hours');
echo '<pre>';
echo $midnight_lastnight.' '.date( 'Y-m-d H:i:s', $midnight_lastnight );
echo $midnight_tonight.' '.date( 'Y-m-d H:i:s', $midnight_tonight );
echo $midnight_tomorrow.' '.date( 'Y-m-d H:i:s', $midnight_tomorrow );
echo '</pre>';
outputs:
--------
1453852800 2016-01-27 00:00:00
1453939200 2016-01-28 00:00:00
1454025600 2016-01-29 00:00:00