raupp/business-hours-diff

A PHP library to calculate business hours between two dates.

1.0.3 2018-05-23 22:24 UTC

This package is not auto-updated.

Last update: 2024-04-28 02:52:23 UTC


README

A PHP library to calculate business hours between two dates

Installation

composer require raupp/business-hours-diff

Usage

$businessOpensAt = 9;
$businessClosesAt = 19;

$date1 = Carbon::parse('2018-04-01 08:02');
$date2 = Carbon::parse('2018-04-01 22:39');

$minutes = (new BusinessHoursDiff())
                ->businessOpensAt(9)
                ->businessClosesAt(19)
                ->diff($date1, $date2);
            
echo $minutes;      // 600