rafael-raupp/business-hours-diff

This package is abandoned and no longer maintained. The author suggests using the raupp/business-hours-diff package instead.

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: 2022-02-01 13:13:22 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