コード例 #1
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);
 }
コード例 #2
0
 /**
  * Gets the month-of-year field using the {@code Month} enum.
  * <p>
  * This method returns the enum {@link Month} for the month.
  * This avoids confusion as to what {@code int} values mean.
  * If you need access to the primitive {@code int} value then the enum
  * provides the {@link Month#getValue() int value}.
  *
  * @return Month the month-of-year, not null
  * @see #getMonthValue()
  */
 public function getMonth()
 {
     return $this->dateTime->getMonth();
 }
コード例 #3
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);
 }