<?php require __DIR__ . '/../vendor/autoload.php'; $response = array(); // ############################################ $m = new \Moment\Moment(); $response['test01'] = $m->format(); // ------------------------------------------ $m = new \Moment\Moment('2012-05-15T12:30:00', 'CET'); $response['test02'] = $m->addHours(2)->format(); // ------------------------------------------ $m = new \Moment\Moment('2012-05-15T12:30:00', 'CET'); $response['test03'] = $m->subtractDays(7)->subtractMinutes(15)->format(); // ------------------------------------------ $m = new \Moment\Moment('2013-02-01T07:00:00'); $result = $m->from('2011-09-25T10:00:00'); $response['test04.01'] = $result->getSeconds(); $response['test04.02'] = $result->getMinutes(); $response['test04.03'] = $result->getHours(); $response['test04.04'] = $result->getDays(); $response['test04.05'] = $result->getWeeks(); $response['test04.06'] = $result->getMonths(); $response['test04.07'] = $result->getYears(); $response['test04.08'] = $result->getRelative(); // ------------------------------------------ $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();