All Projects → code16 → carbon-business-days

code16 / carbon-business-days

Licence: other
A simple class for business days counting

Programming Languages

PHP
23972 projects - #3 most used programming language

Labels

Projects that are alternatives of or similar to carbon-business-days

Graphyte
Python 3 compatible library to send data to a Graphite metrics server (Carbon)
Stars: ✭ 59 (+59.46%)
Mutual labels:  carbon
Carbon
Carbon by Sage | ReactJS UI Component Library
Stars: ✭ 161 (+335.14%)
Mutual labels:  carbon
tfrs
Transportation Fuels Reporting System
Stars: ✭ 21 (-43.24%)
Mutual labels:  carbon
Carbonsublime
🚀 A Sublime Text 3 Plugin for Carbon. (https://carbon.now.sh)
Stars: ✭ 104 (+181.08%)
Mutual labels:  carbon
Carbon Clickhouse
Graphite metrics receiver with ClickHouse as storage
Stars: ✭ 139 (+275.68%)
Mutual labels:  carbon
Nef
💊 steroids for Xcode Playgrounds
Stars: ✭ 226 (+510.81%)
Mutual labels:  carbon
Carbon
🖤 Create and share beautiful images of your source code
Stars: ✭ 29,304 (+79100%)
Mutual labels:  carbon
carbon-preprocess-svelte
Collection of Svelte preprocessors for the Carbon Design System
Stars: ✭ 39 (+5.41%)
Mutual labels:  carbon
Date
🗓 A library to help you work with dates in multiple languages, based on Carbon.
Stars: ✭ 1,773 (+4691.89%)
Mutual labels:  carbon
code2img
🖨️ A carbon-now API wrapper and iOS Shortcut
Stars: ✭ 74 (+100%)
Mutual labels:  carbon
Carbonzipper
proxy to transparently merge graphite carbon backends
Stars: ✭ 104 (+181.08%)
Mutual labels:  carbon
Silicon
Create beautiful image of your source code.
Stars: ✭ 1,761 (+4659.46%)
Mutual labels:  carbon
Carbonapi
Implementation of graphite API (graphite-web) in golang
Stars: ✭ 243 (+556.76%)
Mutual labels:  carbon
Carbon Api
Unofficial API for generating beautiful images of your source code using Carbon.
Stars: ✭ 89 (+140.54%)
Mutual labels:  carbon
hockeystick
Download and Visualize Essential Global Heating Data in R
Stars: ✭ 42 (+13.51%)
Mutual labels:  carbon
Go Carbon
Golang implementation of Graphite/Carbon server with classic architecture: Agent -> Cache -> Persister
Stars: ✭ 713 (+1827.03%)
Mutual labels:  carbon
Test Time
A helper to control the flow of time
Stars: ✭ 169 (+356.76%)
Mutual labels:  carbon
openair-cyan
DIY small-scale open hardware direct air carbon capture device called Cyan. Our documentation is on https://openair-collective.github.io/openair-cyan
Stars: ✭ 54 (+45.95%)
Mutual labels:  carbon
php-helpers
An extensive set of PHP helper functions and classes.
Stars: ✭ 27 (-27.03%)
Mutual labels:  carbon
Travel
Framework agnostic PHP package to control the time.
Stars: ✭ 251 (+578.38%)
Mutual labels:  carbon

A simple business days calculator

This package aims to count business working days between two Carbon dates.

Usage

$date = new BusinessDays();
    
// Set holidays (2018-1-1 is a Monday)
$date->addHoliday(Carbon::createFromDate(2018, 1, 1));
    
// Should return 9
$days = $date->daysBetween(
    Carbon::createFromDate(2018, 1, 1),
    Carbon::createFromDate(2018, 1, 15)
);
    
// Set a closed period (whole 2nd week)
$date->addClosedPeriod(
    Carbon::createFromDate(2018, 1, 8),
    Carbon::createFromDate(2018, 1, 12)
);

// Should return 5
$days = $date->daysBetween(
    Carbon::createFromDate(2018, 1, 1),
    Carbon::createFromDate(2018, 1, 15)
);

Default for weekend days are saturdays and sundays, but it can be configured:

$date->setWeekendDays([Carbon::SUNDAY, Carbon::MONDAY]);

You can also add or subtract days from a given date:

$newDate = $date->addDaysTo(
    Carbon::createFromDate(2018, 5, 14), 
    10
);
$newDate = $date->subDaysFrom(
    Carbon::createFromDate(2018, 5, 14), 
    10
);

Installation

composer require code16/carbon-business-days

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].