2017 © Pedro Peláez
 

library rough-date

Rough date object allowing dates like `Jan 2005` or `2006`

image

mareg/rough-date

Rough date object allowing dates like `Jan 2005` or `2006`

  • Saturday, May 26, 2018
  • by mareg
  • Repository
  • 2 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 25 % Grown

The README.md

Rough Date

Needed to store a "rough date" in one of my project, may be useful for otheres., (*1)

CI Build Status Scrutinizer Code Quality License: GPL v3, (*2)

Installation

Execute from shell the following command:, (*3)

$ composer require mareg/rough-date

Or add "mareg/rough-date": "^1.0" to your composer.json:, (*4)

    "require": {
        "mareg/rough-date": "^1.0"
    },

Usage

Create a RoughDate object from the string:, (*5)

$roughDate = RoughDate::fromString('May 2005');
echo $roughDate->format();

Or from a DateTime date object:, (*6)

$date = new \DateTime();
$roughDate = RoughDate::fromDateTime($date);
echo $roughDate->format();

Accepted date formats

When creating an object through RoughDate::fromString():, (*7)

  • Y-m-d, e.g. 2015-02-22, but also 2013-05-00 and 2013-00-00 are correct
  • Y/m/d and Y.m.d are accepted
  • j. M Y, e.g. 13. May 2005
  • M Y, e.g. May 1985
  • Y, e.g. 1978

Output date formats

When calling RoughDate::format(): * For a full date output accepts all variables as in date() method * For other dates only available variables will be substituded and unavailable ones will be removed, e.g.: * for date 2015-02-00 and format j M Y you'll get Feb 2015 * for date 1978-00-00 and format j M Y you'll get 1978, (*8)

The Versions

26/05 2018

dev-master

9999999-dev

Rough date object allowing dates like `Jan 2005` or `2006`

  Sources   Download

GNU GPL v3.0 GPL-3.0-only

The Requires

  • php >=7.2

 

The Development Requires

26/05 2018

1.0.1

1.0.1.0

Rough date object allowing dates like `Jan 2005` or `2006`

  Sources   Download

GPL-3.0-only

The Requires

  • php >=7.2

 

The Development Requires

01/09 2017

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1

Rough date object allowing dates like `Jan 2005` or `2006`

  Sources   Download

GNU GPL v3.0

The Requires

  • php >=5.4

 

The Development Requires

09/03 2015

0.1.3

0.1.3.0

Rough date object allowing dates like `Jan 2005` or `2006`

  Sources   Download

GNU GPL v3.0

The Requires

  • php >=5.4

 

The Development Requires

22/02 2015

0.1.2

0.1.2.0

Rough date object allowing dates like `Jan 2005` or `2006`

  Sources   Download

GNU GPL v3.0

The Requires

  • php >=5.4

 

The Development Requires

22/02 2015

0.1.1

0.1.1.0

Rough date object allowing dates like `Jan 2005` or `2006`

  Sources   Download

GNU GPL v3.0

The Requires

  • php >=5.4

 

The Development Requires