public function serialize() { return $this->date->getYear() . ':' . $this->date->getMonthValue() . ':' . $this->date->getDayOfMonth() . ':' . $this->time->getHour() . ':' . $this->time->getMinute() . ':' . $this->time->getSecond() . ':' . $this->time->getNano(); }
/** * Gets the second-of-minute field. * * @return int the second-of-minute, from 0 to 59 */ public function getSecond() { return $this->time->getSecond(); }
private function check(LocalTime $test, $h, $m, $s, $n) { $this->assertEquals($test->getHour(), $h); $this->assertEquals($test->getMinute(), $m); $this->assertEquals($test->getSecond(), $s); $this->assertEquals($test->getNano(), $n); $this->assertEquals($test, $test); $this->assertEquals(LocalTime::of($h, $m, $s, $n), $test); }
/** * @dataProvider data_time */ public function test_time_parse(LocalTime $time, FormatStyle $timeStyle, $timeStyleOld, Locale $locale) { $old = \IntlDateFormatter::create($locale->getLocale(), \IntlDateFormatter::NONE, $timeStyleOld, new \DateTimeZone('UTC')); $oldDate = new \DateTime('1970-0-0T' . $time->getHour() . ':' . $time->getMinute() . ':' . $time->getSecond(), new \DateTimeZone('UTC')); $text = $old->format($oldDate); $f = $this->builder->appendLocalized(null, $timeStyle)->toFormatter2($locale); $parsed = $f->parsePos($text, $this->pos); $this->assertEquals($this->pos->getIndex(), strlen($text)); $this->assertEquals($this->pos->getErrorIndex(), -1); $this->assertEquals(LocalTime::from($parsed), $time); }