Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 /**
  * Gets the hour-of-day field.
  *
  * @return int the hour-of-day, from 0 to 23
  */
 public function getHour()
 {
     return $this->time->getHour();
 }
Ejemplo n.º 3
0
 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);
 }