How can I get the timestamp of 12 o'clock of today, yesterday and the day before yesterday by using strtotime() function in php?
12 o'clock is a variable and would be changed by user.
php $date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d'); $prev_date = date('Y-m-d', strtotime($date . ' -1 day')); echo $prev_date; ?>
$hour = 12; $today = strtotime($hour . ':00:00'); $yesterday = strtotime('-1 day', $today); $dayBeforeYesterday = strtotime('-1 day', $yesterday);
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