示例#1
0
 function testFormat()
 {
     $now = strtotime('2016-12-03T12:03:56Z');
     $result = Time::format($now);
     self::assertEquals('2016-12-03T12:03:56Z', $result, 'ISO format fails');
     $result = Time::format($now, Time::FORMAT_FULL);
     self::assertEquals('3rd Dec 2016, 12:03:56 pm GMT', $result, 'Full format fails');
     $result = Time::format($now, Time::FORMAT_READABLE, strtotime('+1 day', $now));
     self::assertEquals('a day ago', $result, 'Readable format fails (1 day)');
     $result = Time::format($now, Time::FORMAT_READABLE, strtotime('+1 day +5 months', $now));
     self::assertEquals('5 months ago', $result, 'Readable format fails (1 day 5 months)');
 }