Log 3978

$hours_worked = 8;
$start_time = “09:00”;
$end_time = “17:00”;
$break_start = “12:30”;
$break_end = “13:00”;

// Calculate total working hours excluding break time
$total_hours_excluding_break = (strtotime($end_time) – strtotime($start_time)) / 3600 – (strtotime($break_end) – strtotime($break_start)) / 3600;

// Check if any of the times crosses midnight for the next day calculation
if (strtotime($end_time) < strtotime("01:00")) {
$total_hours_excluding_break -= (strtotime("00:00") – strtotime("24:00")) / 3600;
}

return $total_hours_excluding_break;

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