PHP code example of kalibora / datetime-immutable-factory
1. Go to this page and download the library: Download kalibora/datetime-immutable-factory library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kalibora / datetime-immutable-factory example snippets
$immutable1 = DateTimeImmutableFactory::create(new \DateTime());
$immutable2 = DateTimeImmutableFactory::create(new \DateTimeImmutable());
function addOneDay(\DateTimeInterface $date) : \DateTimeInterface
{
// Call to an undefined method DateTimeInterface::modify()
// $date->modify();
return DateTimeImmutableFactory::create($date)->modify('+1 day');
}