Log 2705

function calculateTimeDifference($endTime, $startTime) {
list($hours1, $minutes1) = explode(‘:’, $endTime);
list($hours2, $minutes2) = explode(‘:’, $startTime);

$total_minutes1 = $hours1 * 60 + $minutes1;
$total_minutes2 = $hours2 * 60 + $minutes2;

// Calculate time difference in minutes
$difference_minutes = abs($total_minutes1 – $total_minutes2);

// Convert minutes to hours and minutes
$difference_hours = floor($difference_minutes / 60);
$difference_minutes %= 60;

// Format the result as hh:mm
return str_pad($difference_hours, 2, ‘0’, STR_PAD_LEFT) . ‘:’ . str_pad($difference_minutes, 2, ‘0’, STR_PAD_LEFT);
}

$endTime = #שעת סיום#;
$startTime = #שעת התחלה#;

$result = calculateTimeDifference($endTime, $startTime);

return “The time difference is: ” . ($result ? : ’00:00′);

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
  • Attributes
  • Custom attributes
  • Custom fields
Click outside to hide the comparison bar
Compare