Download the PHP package mawebdk/utc-datetime without Composer
On this page you can find all versions of the php package mawebdk/utc-datetime. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mawebdk/utc-datetime
More information about mawebdk/utc-datetime
Files in mawebdk/utc-datetime
Package utc-datetime
Short Description Representation of a UTC date and time with easy mocking of current date and time for testing.
License BSD-2-Clause
Informations about the package utc-datetime
utc-datetime
This package contains a representation of a UTC date and time with easy mocking of current date and time for testing.
Use UtcDateTime and UtcDateTimeImmutable to handle UTC date and times.
UtcDateTime and UtcDateTimeImmutable behaves the same, except:
- When calling modification methods on a UtcDateTime object, the object is modified itself.
- When calling modification methods on a UtcDateTimeImmutable object, a new object will be returned.
Usage
Create a new UtcDateTime object with the current UTC date and time.
Note: Method now() uses Clock to get current date and time to enable support for mocking of current date and time.
Create a new UtcDateTime object with a given Unix timestamp with optional milliseconds or microseconds.
Get Unix timestamp with optional milliseconds or microseconds from a UtcDateTime object.
Get MySQL date and time with microseconds format from a UtcDateTime object.
Mocking of current UTC date and time
Use ReflectionClass to set the Clock singleton to a mocked class implementing ClockInterface.
Remember to reset singleton to ensure usage of correct date and time in subsequent tests.
All versions of utc-datetime with dependencies
mawebdk/clock Version ^1.0.1
mawebdk/preg-match Version ^1.0.0
mawebdk/to-string-builder Version ^2.0.1