2017 © Pedro Peláez
 

library datefactory

A factory class for DateTime objects.

image

vascowhite/datefactory

A factory class for DateTime objects.

  • Wednesday, October 12, 2016
  • by vascowhite
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

DateFactory

A factory for \DateTime objects with checks that the date string supplied matches the format supplied., (*1)

Installation

Install using composer, add the following to composer.json:-, (*2)

"require": {
    "vascowhite/datefactory": "dev-master"
}

Why

Because \DateTime::createFromFormat() does stupid things and I needed a way of doing server side validation on user supplied dates., (*3)

DateFactory

There is just one public method:, (*4)

DateFactory::getDate()

Signature:-, (*5)

TimeValue __construct(String $date, String $format = 'Y-m-d H:i:s', [String $timeZone])

Arguments $date is a string representing a date/time, e.g. '2014-14 14:12:10'. $format Optional format string, defaults to 'Y-m-d H:i:s'. Available formats are any available for \DateTime::createFromFormat(). $timeZone A valid Time Zone identifier from this list., (*6)

Example, (*7)

$dateTime = DateFactory::getDate('2014-12-25 12:00:00',  'Y-m-d H:i:s', 'Europe/London');

Return Returns a TimeValue object or false on failure., (*8)

Throws \InvalidArgumentException if passed an invalid Time Zone string., (*9)


The Versions

12/10 2016

1.1.1.x-dev

1.1.1.9999999-dev

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

12/10 2016

v1.1.1

1.1.1.0

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

12/10 2016

1.1.0.x-dev

1.1.0.9999999-dev

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

12/10 2016

v1.1.0

1.1.0.0

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

15/12 2014

1.0.1.x-dev

1.0.1.9999999-dev

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

14/12 2014

1.0.0.x-dev

1.0.0.9999999-dev

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

14/12 2014

v1.0.1

1.0.1.0

A factory class for DateTime objects.

  Sources   Download

GPL-3.0

The Development Requires

datetime

14/12 2014

dev-master

9999999-dev

A factory for DateTime objects

  Sources   Download

The Development Requires

14/12 2014

v1.0.0

1.0.0.0

A factory for DateTime objects

  Sources   Download

The Development Requires