Ejemplo n.º 1
0
// ------------------------------------------
$m = new \Moment\Moment('2014-12-09T07:00:00');
$result = $m->fromNow();
$response['test05.00'] = $m->format('c');
$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();
$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');