codeinc / datetime
This package is abandoned and no longer maintained.
No replacement package was suggested.
Code Inc.'s datetime library
1.2.0
2018-03-13 19:27 UTC
Requires
- php: >=7.1
README
The is just an overlayoer above the native PHP DateTime class with extra methods.
Usage
<?php use CodeInc\DateTime\DateTime; /* * Can be instantiated with a timestamp (checked with is_numeric()) */ $dateTime = new DateTime(time()); /* * Provides methods to tests the current time */ $dateTime->isUndefined(); $dateTime->isPast(); $dateTime->isNow(); $dateTime->isFutur(); /* * Provides methods to get SQL dates */ $dateTime->getSqlDate(); // YYYY-MM-DD $dateTime->getSqlDateTime(); // AAAA-MM-JJ HH:MM:SS /* * Provides a method to get a RFC 1123 date */ $dateTime->getRfc1123(); /* * The formats are available in class constants */ $dateTime::FORMAT_SQL_DATE; $dateTime::FORMAT_SQL_DATETIME; $dateTime::FORMAT_RFC_1123;
Installation
This library is available through Packagist and can be installed using Composer:
composer require codeinc/datetime
License
The library is published under the MIT license (see LICENSE
file).