ordinary / datetime
Library with DateTimeImmutable extension for easy time operations.
1.2.0
2023-02-28 10:57 UTC
Requires
- php: ^8.2
Requires (Dev)
- captainhook/captainhook: ^5.14
- captainhook/plugin-composer: ^5.3
- overtrue/phplint: ^6.1
- phpunit/phpunit: ^9.6
- psalm/plugin-phpunit: ^0.18
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^8.8
- squizlabs/php_codesniffer: ^3.7
- vimeo/psalm: ^5.7
README
This library provides an extended DateTimeImmutable class that provides additional functionality.
Getting Started
Install using composer.
composer require ordinary/datetime
Usage
$dateTime = new \Ordinary\DateTime\DateTimeImmutable(); var_dump([ 'Start of day' => $dateTime->startOfDay()->format('c'), 'End of day' => $dateTime->endOfDay()->format('c'), 'Is leap year' => $dateTime->leapYear(), 'Is same minute' => $dateTime->isSameMinute(new DateTime()), 'Is before' => $dateTime->isBefore(new DateTime()), 'Current hour' => $dateTime->hour(), 'Day of Week' => $dateTime->dayOfWeekEnum(), ]);