PHP code example of rtuin / carbon-normalizer

1. Go to this page and download the library: Download rtuin/carbon-normalizer 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/ */

    

rtuin / carbon-normalizer example snippets


$normalizer = new \Rtuin\Normalizer\CarbonDateTimeNormalizer();

$normalized = $normalizer->normalize(\Carbon\CarbonImmutable::now());
// $normalized is now a string '2019-05-28T07:25:00+02:00'


$result = $normalizer->denormalize('2019-05-28T07:25:00+02:00', CarbonImmutable::class);
// $result is now a CarbonImmutable instance