<?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->add('hours', 2)->format(); // ------------------------------------------ $m = new \Moment\Moment('2012-05-15T12:30:00', 'CET'); $response['test03'] = $m->subtract('days', 7)->subtract('minutes', 15)->format(); // ------------------------------------------ $m = new \Moment\Moment('2012-05-12T15: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(); // ------------------------------------------ $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');