PHP code example of pjkober / datetimeintervalbundle
1. Go to this page and download the library: Download pjkober/datetimeintervalbundle 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/ */
pjkober / datetimeintervalbundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new pjkober\datetimeintervalbundle\EinsteDateTimeIntervalBundle(),
);
// ...
}
// Use the functions with PHP
echo $view['time']->dateToDays($dateTime);
// returns something like "10" or "-10", count days interval between $dateTime and now
echo $view['time']->dateToDays($dateTime1, $dateTime1);
// count days interval between $dateTime1 and $dateTime2
echo $view['time']->dateToHours($dateTime);
// returns something like "24" or "-36", count interval between $dateTime and now
echo $view['time']->dateToHours($dateTime1, $dateTime1);
// count hours interval between $dateTime1 and $dateTime2
echo $view['time']->dateToMinutes($dateTime);
// returns something like "1140" or "-1140" minutunt interval between $dateTime and now
echo $view['time']->dateToMinutes($dateTime1, $dateTime1);
// count minutes interval between $dateTime1 and $dateTime2
echo $view['time']->dateToSeconds($dateTime);
// returns something like "1140" or "-1140", count interval between $dateTime and now
echo $view['time']-> dateToSeconds($dateTime1, $dateTime1);
// count Seconds interval between $dateTime1 and $dateTime2