Ejemplo n.º 1
0
 /**
  * Gets the day-of-month field.
  * <p>
  * This method returns the primitive {@code int} value for the day-of-month.
  *
  * @return int the day-of-month, from 1 to 31
  */
 public function getDayOfMonth()
 {
     return $this->dateTime->getDayOfMonth();
 }
Ejemplo n.º 2
0
 private function check(LocalDateTime $test, $y, $m, $d, $h, $mi, $s, $n)
 {
     $this->assertEquals($test->getYear(), $y);
     $this->assertEquals($test->getMonth()->getValue(), $m);
     $this->assertEquals($test->getDayOfMonth(), $d);
     $this->assertEquals($test->getHour(), $h);
     $this->assertEquals($test->getMinute(), $mi);
     $this->assertEquals($test->getSecond(), $s);
     $this->assertEquals($test->getNano(), $n);
     $this->assertEquals($test, $test);
     //$this->assertEquals($test->hashCode(), $test->hashCode());
     $this->assertEquals(LocalDateTime::of($y, $m, $d, $h, $mi, $s, $n), $test);
 }
Ejemplo n.º 3
0
 /**
  * Adds a single transition rule to the current window.
  * <p>
  * This adds a rule such that the offset, expressed as a daylight savings amount,
  * changes at the specified date-time.
  *
  * @param LocalDateTime $transitionDateTime the date-time that the transition occurs as defined by timeDefintion, not null
  * @param TimeDefinition $timeDefinition the definition of how to convert local to actual time, not null
  * @param int $savingAmountSecs the amount of saving from the standard offset after the transition in seconds
  * @return ZoneRulesBuilder $this, for chaining
  * @throws \LogicException if no window has yet been added
  * @throws \LogicException if the window already has fixed savings
  * @throws \LogicException if the window has reached the maximum capacity of 2000 rules
  */
 public function addRuleToWindow(LocalDateTime $transitionDateTime, TimeDefinition $timeDefinition, $savingAmountSecs)
 {
     return $this->addRuleToWindow9($transitionDateTime->getYear(), $transitionDateTime->getYear(), $transitionDateTime->getMonth(), $transitionDateTime->getDayOfMonth(), null, $transitionDateTime->toLocalTime(), false, $timeDefinition, $savingAmountSecs);
 }
 public function setFieldsDateTime(LocalDateTime $dt)
 {
     if ($dt !== null) {
         $this->fields->put(ChronoField::YEAR(), $dt->getYear());
         $this->fields->put(ChronoField::MONTH_OF_YEAR(), $dt->getMonthValue());
         $this->fields->put(ChronoField::DAY_OF_MONTH(), $dt->getDayOfMonth());
         $this->fields->put(ChronoField::DAY_OF_YEAR(), $dt->getDayOfYear());
         $this->fields->put(ChronoField::DAY_OF_WEEK(), $dt->getDayOfWeek()->getValue());
         $this->fields->put(IsoFields::WEEK_BASED_YEAR(), $dt->getLong(IsoFields::WEEK_BASED_YEAR()));
         $this->fields->put(IsoFields::WEEK_OF_WEEK_BASED_YEAR(), $dt->getLong(IsoFields::WEEK_OF_WEEK_BASED_YEAR()));
         $this->fields->put(ChronoField::HOUR_OF_DAY(), $dt->getHour());
         $this->fields->put(ChronoField::MINUTE_OF_HOUR(), $dt->getMinute());
         $this->fields->put(ChronoField::SECOND_OF_MINUTE(), $dt->getSecond());
         $this->fields->put(ChronoField::NANO_OF_SECOND(), $dt->getNano());
     }
 }