get hours difference between two dates in php
$hourdiff = round((strtotime($time1) - strtotime($time2))/3600, 1);
get hours difference between two dates in php
$hourdiff = round((strtotime($time1) - strtotime($time2))/3600, 1);
php hour between
$currentTime = (new DateTime('01:00'))->modify('+1 day');
$startTime = new DateTime('22:00');
$endTime = (new DateTime('07:00'))->modify('+1 day');
if ($currentTime >= $startTime && $currentTime <= $endTime) {
// Do something
}
calculate time difference php
$time1 = new DateTime('09:00:59');
$time2 = new DateTime('09:01:00');
$interval = $time1->diff($time2);
echo $interval->format('%s second(s)');
Result: 1 second(s)
php time difference in hours
date_default_timezone_set("Africa/Johannesburg");
$now = new DateTime();
$future_date = new DateTime('2020-10-21 00:00:00');
$interval = $future_date->diff($now);
echo ($interval->format("%a") * 24) + $interval->format("%h"). " hours". $interval->format(" %i minutes ");
print_r($now->format('Y-m-d H:i:s'));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us