How to display the current date in ms since epoch in PHP? -
i display today's date number of ms since epoch
i know can use
microtime(true) / 1000
to so, strip hour, minutes, ms result. 2016/01/28 00:00:00 in ms. of course example, want date current day. idea on how in php ?
how 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
Comments
Post a Comment