PHP code example of mossengine / alteredcarbon

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

    

mossengine / alteredcarbon example snippets



$stringAltSO8601 = '20180215135543:Australia/Brisbane';

$alteredCarbon = new Mossengine\AlteredCarbon\AlteredCarbon($stringAltSO8601);

$alteredCarbon->toDateTimeString();
// -> 2018-02-15 13:55:43

$alteredCarbon->getTimezone()->getName();
// -> Australia/Brisbane


$stringAltSO8601 = '20180215135543:Australia/Brisbane';

$alteredCarbon = Mossengine\AlteredCarbon\AlteredCarbon::createFromAltSO8601($stringAltSO8601);

$alteredCarbon->toDateTimeString();
// -> 2018-02-15 13:55:43

$alteredCarbon->getTimezone()->getName();
// -> Australia/Brisbane


$stringDateTime = '2018-02-15 13:55:43';
$stringTimeZone = 'Australia/Brisbane';

$alteredCarbon = new Mossengine\AlteredCarbon\AlteredCarbon($stringDateTime, $stringTimeZone);

$alteredCarbon->toAltSO8601String();
// -> 20180215135543:Australia/Brisbane 


Mossengine\AlteredCarbon\AlteredCarbon;

printf("AltSO8601 Now: %s", AlteredCarbon::now()->toAltSO8601String());


Mossengine\AlteredCarbon\AlteredCarbon;

printf("AltSO8601 Now: %s", AlteredCarbon::now()->toAltSO8601String());