2017 © Pedro Peláez
 

library melody-datetime

PHP's DateTime extension

image

leviferreira/melody-datetime

PHP's DateTime extension

  • Friday, July 10, 2015
  • by leviferreira
  • Repository
  • 1 Watchers
  • 12 Stars
  • 251 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 2 Versions
  • 6 % Grown

The README.md

Melody Datetime

Join the chat at https://gitter.im/project-melody/datetime, (*1)

Build Status, (*2)

Installation

The recommended way to install Melody DateTime is through composer. Just create a composer.json file and run the php composer.phar install command to install it:, (*3)

    {
        "require": {
            "project-melody/datetime": "dev-master"
        }
    }

Introduction

Importing DateTime namespace:, (*4)

use Melody\DateTime\DateTime;

Basic Usage

Adding business days to a date

    // Sets the datetime, will consider the 'now' date
    // for example: 2013-12-01 00:00:00
    $datetime = new DateTime();

    // add two business days to a date
    $datetime->addBusinessDays(2);

    // Output: 2013-12-03 00:00:00
    echo $datetime->format('Y-m-d H:i:s');

Adding business days to a date, considering holidays

    // Sets the datetime, will consider the 'now' date
    // for example: 2013-12-01 00:00:00
    $datetime = new DateTime();

    // Set a list of holidays that will be considered
    $datetime->setHolidays(array('2013-12-02'));

    // Add two business days to a date, considering holidays as non-business days
    $datetime->addBusinessDaysWithHolidays(2);

    // Output: 2013-12-04 00:00:00
    echo $datetime->format('Y-m-d H:i:s');

The Versions

10/07 2015

dev-master

9999999-dev https://github.com/leviferreira/melody-datetime

PHP's DateTime extension

  Sources   Download

BSD Style

The Requires

  • php >=5.3.3

 

by Levi Ferreira

29/12 2014

dev-develop

dev-develop https://github.com/project-melody/datetime

PHP's DateTime extension

  Sources   Download

BSD Style

The Requires

  • php >=5.4

 

by Levi Ferreira