2017 © Pedro Peláez
 

library phperiod

Showing translated and ranged DateTime in PHP.

image

maidmaid/phperiod

Showing translated and ranged DateTime in PHP.

  • Wednesday, April 26, 2017
  • by maidmaid
  • Repository
  • 1 Watchers
  • 1 Stars
  • 174 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Phperiod

Build Status, (*1)

Showing translated and ranged DateTime in PHP., (*2)

Require PHP >= 5.6 with Intl extension., (*3)

Installation

Use Composer to install Phperiod in your project:, (*4)

composer require "maidmaid/phperiod"

Usage

Same day:, (*5)

echo Phperiod::period('2016-10-15');
// Saturday, October 15, 2016

echo Phperiod::period('2016-10-15 12:00');
// Saturday, October 15, 2016 at 12:00 PM

echo Phperiod::period('2016-10-15 12:00', '2016-10-15 13:00');
// Saturday, October 15, 2016 from 12:00 PM to 1:00 PM

Ranged dates:, (*6)

echo Phperiod::period('2016-10-15', '2016-10-17');
// from Saturday, October 15, 2016 to Monday, October 17, 2016

echo Phperiod::period('2016-10-15 12:00', '2016-10-17');
// from Saturday, October 15, 2016 to Monday, October 17, 2016 at 12:00 PM

echo Phperiod::period('2016-10-15 12:00', '2016-10-17 13:00');
// from Saturday, October 15, 2016 to Monday, October 17, 2016 from 12:00 PM to 1:00 PM

Ranged dates with days of week:, (*7)

echo Phperiod::period('2016-10-15', '2016-10-29', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday, from Saturday, October 15, 2016 to Saturday, October 29, 2016

echo Phperiod::period('2016-10-15 12:00', '2016-10-29', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday at 12:00 PM, from Saturday, October 15, 2016 to Saturday, October 29, 2016

echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat']);
// Monday, Thursday and Saturday from 12:00 PM to 1:00 PM, from Saturday, October 15, 2016 to Saturday, October 29, 2016

With custom format:, (*8)

$formatter = new \IntlDateFormatter('en', \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat'], $formatter);
// Monday, Thursday and Saturday from 12:00 PM to 1:00 PM, from 10/15/16 to 10/29/16

Translated dates:, (*9)

$fr = new \IntlDateFormatter('fr');
echo Phperiod::period('2016-10-15 12:00', '2016-10-29 13:00', ['Mon', 'Thu', 'Sat'], $fr);
// lundi, jeudi et samedi de 12:00 à 13:00, du samedi 15 octobre 2016 au samedi 29 octobre 2016

// if special keywords don't have translation, they are remplaced by generic
// symbols ('from' and 'to' remplaced by '→'), like with Zulu locale
$zu = new \IntlDateFormatter('zu', \IntlDateFormatter::SHORT, \IntlDateFormatter::SHORT);
echo Phperiod::period('2016-10-15 12:00', '2016-10-17 13:00', [], $zu);
// 10/15/16 → 10/17/16 12:00 Ntambama → 1:00 Ntambama

License

Phperiod is licensed under the MIT License - see the LICENSE file for details., (*10)

The Versions

26/04 2017

dev-master

9999999-dev https://github.com/maidmaid/phperiod

Showing translated and ranged DateTime in PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

date range time datetime intl

26/04 2017

v0.1.1

0.1.1.0 https://github.com/maidmaid/phperiod

Showing translated and ranged DateTime in PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

date range time datetime intl

27/10 2016

v0.1.0

0.1.0.0 https://github.com/maidmaid/phperiod

Showing translated and ranged DateTime in PHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

date range time datetime intl