silvesterk/business-days 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

silvesterk/business-days

最新稳定版本:v2.0

Composer 安装命令:

composer require silvesterk/business-days

包简介

A simple helper class used for calculating business days

README 文档

README

A simple helper PHP library used for calculating business days,

Installation

composer require silvesterk/business-days

Classes

BusinessDays

getBusinessDayNumberFromRange

    /**
     * @param DateRange $dateRange
     * @return int
     */
    public function getBusinessDayNumberFromRange(DateRange $dateRange)

Method that takes in a date range and returns the number of business or work days between those two dates (+1)

Example
$bizDays = new BusinessDays();
$dateRange = new DateRange('yesterday','today');
$businessDays = $bizDays->getBusinessDayNumberFromRange($dateRange);

isBusinessDay

    /**
     * @param \DateTime $dateTime
     * @return bool
     */
    public function isBusinessDay(\DateTime $dateTime)

Returns true if the provided date is a business day.

Example
$isTodayABizDay = $bizDays->isBusinessDay(new \DateTime());

isWeekend

    /**
     * @param \DateTime $dateTime
     * @return bool
     */
    public function isWeekend(\DateTime $dateTime)

Returns true if the provided date is a weekend day.

Example
$isItWeekend = $bizDays->isWeekend(new \DateTime());

isHoliday

    /**
     * @param \DateTime $dateTime
     * @return bool
     */
    public function isHoliday(\DateTime $dateTime)

Returns true if the provided date is a holiday.

Example
$isItAHoliday = $bizDays->isHoliday(new \DateTime());

getHolidays

Returns the list of holidays

addHoliday

    /**
     * @param \DateTime $dateTime
     */
    public function addHoliday(\DateTime $dateTime)

Adds a holiday to the holiday list

Example

Add today as a holiday (the current instantiation of the class will not count today as a business day).

$bizDays->addHoliday(new \DateTime());

DateRange

A simple helper class used for defining two date times (from, to)

统计信息

  • 总下载量: 2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-07-03