PHP code example of divineomega / php-dot-net-ticks
1. Go to this page and download the library: Download divineomega/php-dot-net-ticks 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/ */
divineomega / php-dot-net-ticks example snippets
use DivineOmega\DotNetTicks\Ticks;
// Current time
$ticks = new Ticks();
// Specific time in ticks
$ticks = new Ticks(636536021491253348);
// From timestamp
$ticks = Ticks::createFromTimestamp(1518005349);
$ticks = $ticks->ticks(); // Ticks
$time = $ticks->timestamp(); // UNIX timstamp
$dateTime = $ticks->dateTime(); // PHP DateTime object
$carbon = $ticks->carbon(); // Carbon date object
// Get current time in ticks
$nowInTicks = (new Ticks())->ticks();
// Convert ticks to timestamp
$timestamp = (new Ticks(636536021491253348))->timestamp();
// Convert timestamp to ticks
$ticks = Ticks::createFromTimestamp(1518005349)->ticks();
composer