PHP code example of pauci / datetime
1. Go to this page and download the library: Download pauci/datetime 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/ */
pauci / datetime example snippets
use Pauci\DateTime\DateTime;
$now = $clock->now();
// or
DateTime::setClock($clock);
$now = DateTime::now();
echo $now; // 2016-05-20T14:30:54.345678+02:00
echo json_encode($now); // "2016-05-20T14:30:54.345678+02:00"
echo DateTime::fromTimestamp(1512148033); // 2017-12-01T18:07:13+01:00
echo DateTime::fromFloatTimestamp(1512148033.000005); // 2017-12-01T18:07:13.000005+01:00
DateTime::setFormat('Y-m-d H:i:s');
echo $now; // 2016-05-20 14:30:54
echo json_encode($now); // "2016-05-20 14:30:54"