Example #1
0
$response['test05.03'] = $result->getHours();
$response['test05.04'] = $result->getDays();
$response['test05.05'] = $result->getWeeks();
$response['test05.06'] = $result->getMonths();
$response['test05.07'] = $result->getYears();
$response['test05.08'] = $result->getRelative();
// ------------------------------------------
$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$response['test06.01'] = $m->format();
$response['test06.02'] = $m->setTimezone('UTC')->format();
// ------------------------------------------
$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$response['test07'] = $m->format('l, dS F Y / H:i (e)');
// ------------------------------------------
$m = new \Moment\Moment('2013-10-23T10:00:00', 'CET');
$momentPeriodVo = $m->getPeriod('week');
$response['test08.00'] = $momentPeriodVo->getRefDate()->format('Y-m-d');
$response['test08.01'] = $momentPeriodVo->getStartDate()->format('Y-m-d');
$response['test08.02'] = $momentPeriodVo->getEndDate()->format('Y-m-d');
$response['test08.03'] = $momentPeriodVo->getInterval();
$momentPeriodVo = $m->getPeriod('month');
$response['test08.04'] = $momentPeriodVo->getStartDate()->format('Y-m-d');
$response['test08.05'] = $momentPeriodVo->getEndDate()->format('Y-m-d');
$response['test08.06'] = $momentPeriodVo->getInterval();
$momentPeriodVo = $m->getPeriod('quarter');
$response['test08.07'] = $momentPeriodVo->getStartDate()->format('Y-m-d');
$response['test08.08'] = $momentPeriodVo->getEndDate()->format('Y-m-d');
$response['test08.09'] = $momentPeriodVo->getInterval();
// ------------------------------------------
//$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$response['test09.01'] = $m->format('l, F jS Y g:i A');
Example #2
0
// ------------------------------------------
$m = new \Moment\Moment('2013-02-01T07:00:00');
$result = $m->fromNow();
$response['test05.01'] = $result->getSeconds();
$response['test05.02'] = $result->getMinutes();
$response['test05.03'] = $result->getHours();
$response['test05.04'] = $result->getDays();
$response['test05.05'] = $result->getWeeks();
// ------------------------------------------
$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$response['test06.01'] = $m->format();
$response['test06.02'] = $m->setTimezone('UTC')->format();
// ------------------------------------------
$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$response['test07'] = $m->format('l, dS F Y / H:i (e)');
// ------------------------------------------
$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$momentPeriodVo = $m->getPeriod('week');
$response['test08.01'] = $momentPeriodVo->getStartDate()->format('Y-m-d');
$response['test08.02'] = $momentPeriodVo->getEndDate()->format('Y-m-d');
$response['test08.03'] = $momentPeriodVo->getRefDate()->format('Y-m-d');
// ------------------------------------------
$m = new \Moment\Moment('2012-04-25T03:00:00', 'CET');
$response['test09.01'] = $m->format('l, F jS Y g:i A');
$response['test09.02'] = $m->format('LLLL', new \Moment\CustomFormats\MomentJs());
// ############################################
$tmpl = join('', file('test.html'));
foreach ($response as $key => $value) {
    $tmpl = str_replace('{{' . $key . '}}', $value, $tmpl);
}
echo $tmpl;