2017 © Pedro PelĂĄez
 

library datetime

PHP DateTime Helper classes

image

tomkyle/datetime

PHP DateTime Helper classes

  • Thursday, April 10, 2014
  • by tomkyle
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

tomkyle/DateTime

This small package contains ~~some date and time related classes~~ for the time being a small class that creates a MySQL-ready string representation from a PHP DateTime object., (*1)

As you know, PHP's DateTime class already offers a format method. But calling it everytime you need it in MySQL context with that Y-m-d H:i:s parameter may be annoying (and feel unclean, somehow)., (*2)

Usage

<?php
use \tomkyle\DateTime\MySqlDateTimeFormatter;

$now = new \DateTime("now");

// prints s'th. like "2014-04-09 15:00:00"
echo new MySqlDateTimeFormatter( $now );

// prints s'th. like "2014-04-23 15:00:00"
echo new MySqlDateTimeFormatter( new \DateTime( "14day" ));

As of PHP5.5, there is a DateTimeInterface interface which would perfectly suit the Dependency Injection used here. I am quite confident there soon will be a PHP5.4 polyfill
, (*3)

Installation via Composer

Install from command line or composer.json file:, (*4)

Command line
composer require tomkyle/datetime
composer.json
"require": {
    "tomkyle/datetime": "~1.0"
}

The Versions

10/04 2014

dev-develop

dev-develop

PHP DateTime Helper classes

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

10/04 2014

dev-master

9999999-dev

PHP DateTime Helper classes

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

10/04 2014

1.0.1

1.0.1.0

PHP DateTime Helper classes

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt

10/04 2014

1.0.0

1.0.0.0

PHP DateTime Helper classes

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Carsten Witt