/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/chronos
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/chronos/README.md (5351B)
# CakePHP Chronos
[](https://travis-ci.com/cakephp/chronos)
[](https://packagist.org/packages/cakephp/chronos)
[](https://packagist.org/packages/cakephp/chronos/stats)
[](https://coveralls.io/r/cakephp/chronos?branch=master)
[](LICENSE)
Chronos aims to be a drop-in replacement for `nesbot/carbon`. It focuses on providing
immutable date/datetime objects. Immutable objects help ensure that datetime objects
aren't accidentally modified keeping data more predictable.
# Installation
Installing with composer:
```
$ composer require cakephp/chronos
```
You can then use Chronos:
```php
modify('+2 hours');
// This will keep modifications
$date = new Chronos('2015-10-21 16:29:00');
$date = $date->modify('+2 hours');
```
## Getting Mutable Objects
In the case that you need a mutable instance you can get one:
```php
$time = new Chronos('2015-10-21 16:29:00');
$mutable = $time->toMutable();
$date = new Date('2015-10-21');
$mutable = $date->toMutable();
```
## Converting Mutable Objects into Immutable ones.
If you have a mutable object and want an immutable variant you can do the following:
```php
$time = new MutableDateTime('2015-10-21 16:29:00');
$fixed = $time->toImmutable();
$date = new MutableDate('2015-10-21');
$fixed = $date->toImmutable();
```
# Calendar Dates
PHP only offers datetime objects as part of the native extensions. Chronos adds
a number of conveniences to the traditional DateTime object and introduces
a `Date` object. `Date` instances offer compatibility with the
`ChronosInterface`, but have their time frozen to `00:00:00` and the timezone
set to the server default timezone. This makes them ideal when working with
calendar dates as the time components will always match.
```php
use Cake\Chronos\Date;
$today = new Date();
echo $today;
// Outputs '2015-10-21'
echo $today->modify('+3 hours');
// Outputs '2015-10-21'
```
Like instances of `Chronos`, `Date` objects are also *immutable*. The
`MutableDate` class provides a mutable variant of `Date`.
# Documentation
A more descriptive documentation can be found at [book.cakephp.org/chronos/2/en/](https://book.cakephp.org/chronos/2/en/).
# API Documentation
API documentation can be found on [api.cakephp.org/chronos](https://api.cakephp.org/chronos).