Given any unix-timestamp T, I want to fetch the timestamp of the midnight before T.
The given timestamp can be any integer: now, today, (not too far[]) in the future or (not too far[]) in the past.
Is there a cleaner way then (pseudocode):
<?php
$midnight = strtotime("{date('d',$ts)}-{date('m',$ts)}-{date('Y', $ts)} midnight");
?>
Thanks.
[*] somewhere between 1990 and 2020.
I would do it as
$midnight = strtotime(date('Y-m-d',$ts).' 00:00:00');
...but whether that is cleaner/better is debatable...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With