コード例 #1
0
 /**
  * @param string|null $modifier
  *
  * @return TimePoint
  */
 public function getTimepoint($modifier = null)
 {
     $now = $this->clock->read();
     if ($modifier) {
         $now->modify($modifier);
     }
     return $now;
 }
コード例 #2
0
 public function testFromStringManualFormat()
 {
     $format = 'Y-m-d\\TH:i:sP';
     $input = '2015-12-10T10:10:00Z';
     $expected = '2015-12-10 10:10:00.000000 UTC';
     $clock = new Clock();
     $output = $clock->fromString($input, $format);
     $this->assertInstanceOf(TimePoint::CLASS, $output);
     $this->assertEquals($expected, $output->format('Y-m-d H:i:s.u e', 'UTC'));
 }