public static function fromTimestamp($timestamp) { $dateTime = new DateTime(); $dateTime->setTimestamp($timestamp); return new Clock($dateTime); }
/** * @test */ public function shouldCreateClockForGivenTimestamp() { //given $clock = Clock::fromTimestamp(1427207001)->setTimezone('UTC'); //when $result = $clock->format(); //then $this->assertEquals('2015-03-24 14:23:21', $result); }