Skip to content

The script counts the working hour. For example, you need to make a newsletter only during working hours and days. Or work out a calendar of working year taking into account all details.

License

Notifications You must be signed in to change notification settings

mackrais-organization/working-date-time-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP script Working Date Time

Content

Installation

Either run

how install

How to use

           $workingDateTime = new WorkingDateTime();

           echo $workingDateTime
                ->setExceptionDates(['01-01']) // Exception date for example always New Year
                ->setWeekends(['Sunday', 'Saturday']) // Weekends days
                ->setDateFrom(date('Y-m-d H:i:s', strtotime('2019-02-01 10:10:20'))) // set date start from 
                ->setStartHourWorkingDay(6)
                ->setStartMinuteWorkingDay(30)
                ->setEndHourWorkingDay(14)
                ->setEndMinuteWorkingDay(30)
                ->setHours(12)
                ->setMinutes(30)
                ->calculate()
                ->format('Y-m-d H:i:s');
                
               // result 2019-02-05 06:40:20
                
           // Reverse date time
           $workingDateTime = new WorkingDateTime();

           echo $workingDateTime
                ->setExceptionDates(['01-01']) // Exception date for example always New Year
                ->setWeekends(['Sunday', 'Saturday']) // Weekends days
                ->setDateFrom(date('Y-m-d H:i:s', strtotime('2019-02-01 10:10:20'))) // set date start from 
                ->setStartHourWorkingDay(6)
                ->setStartMinuteWorkingDay(30)
                ->setEndHourWorkingDay(14)
                ->setEndMinuteWorkingDay(30)
                ->setHours(12)
                ->setMinutes(30)
                ->asReverse()
                ->calculate()
                ->format('Y-m-d H:i:s');
                
                // result 2019-01-31 21:40:20

License

working-date-time-php is released under the MIT License. See the bundled LICENSE.md for details.

About

The script counts the working hour. For example, you need to make a newsletter only during working hours and days. Or work out a calendar of working year taking into account all details.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages