2017 © Pedro Peláez
 

library datetime

A libary to handle dates and times separately from one another.

image

datetime/datetime

A libary to handle dates and times separately from one another.

  • Friday, July 13, 2018
  • by heiglandreas
  • Repository
  • 2 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

DateTime

A libary to handle dates and times separately from one another., (*1)

Latest Stable Version License Build Status Scrutinizer Code Quality Coverage Status, (*2)

Background

So far all the libraries around that help handling Dates and Times all extend one of PHPs DateTime-Objects., (*3)

This library tries to address that by providing two separate Objects that handle Dates and Times respectively. Internaly they do use PHPs DateTimeImmutable-Object but that's not exposed to the outside., (*4)

So now you can use a Date-Object without having to worry about the time-component and vice-versa., (*5)

Installation

This library is best installed using composer., (*6)

composer require datetime/datetime

Usage

Date

There is a Date-Object as well as a DateInterval-Object, (*7)

Easiest usage is like this:, (*8)

$date = new \DateTime\Date('2018-07-05');
echo $date->format('d. m. Y');
// 05. 07. 2018
echo $date->format('jS \o\f F Y H:i:s');
// 5th of July 2018 H:i:s

Another possibility would be to use it like this:, (*9)

$date = new \DateTime\Date('last wednesday of june 2018');
echo $date->format('d. m. Y');
// 27. 06. 2018

Or to use the DateInterval-Object:, (*10)

$date1 = new \DateTime\Date('2018-07-05');
$date2 = new \DateTime\Date('2020-07-05');
$interval = $date1->diff($date2);

echo $interval->format('%d %m %y');
// 731 0 0

Time

There is also a Time-Object as well as a TimeInterval-Object, (*11)

Those can be used as follows:, (*12)

$time = new \DateTime\Time('12:23:34');
echo $time->format('H:i:s');
// 12:23:34
echo $time->format('jS \o\f F Y H:i:s');
// jS of F Y 12:23:34

The Versions

13/07 2018

dev-feature/addDateTime

dev-feature/addDateTime

A libary to handle dates and times separately from one another.

  Sources   Download

MIT

The Requires

  • php ^7.2

 

The Development Requires

11/07 2018

dev-master

9999999-dev

A libary to handle dates and times separately from one another.

  Sources   Download

MIT

The Requires

  • php ^7.2

 

The Development Requires

11/07 2018

0.1.0

0.1.0.0

A libary to handle dates and times separately from one another.

  Sources   Download

MIT

The Requires

  • php ^7.2

 

The Development Requires