function data_format_withZone_withChronology() { $ym = YearMonth::of(2008, 6); $ld = LocalDate::of(2008, 6, 30); $lt = LocalTime::of(11, 30); $ldt = LocalDateTime::of(2008, 6, 30, 11, 30); $ot = OffsetTime::ofLocalTime(LocalTime::of(11, 30), self::OFFSET_PONE()); $odt = OffsetDateTime::ofDateTime(LocalDateTime::of(2008, 6, 30, 11, 30), self::OFFSET_PONE()); $zdt = ZonedDateTime::ofDateTime(LocalDateTime::of(2008, 6, 30, 11, 30), self::ZONE_PARIS()); $thaiZdt = ThaiBuddhistChronology::INSTANCE()->zonedDateTimeFrom($zdt); $instant = Instant::ofEpochSecond(3600); return [[null, null, DayOfWeek::MONDAY(), "::::"], [null, null, $ym, "2008::::ISO"], [null, null, $ld, "2008::::ISO"], [null, null, $lt, ":11:::"], [null, null, $ldt, "2008:11:::ISO"], [null, null, $ot, ":11:+01:00::"], [null, null, $odt, "2008:11:+01:00::ISO"], [null, null, $zdt, "2008:11:+02:00:Europe/Paris:ISO"], [null, null, $instant, "::::"], [IsoChronology::INSTANCE(), null, DayOfWeek::MONDAY(), "::::ISO"], [IsoChronology::INSTANCE(), null, $ym, "2008::::ISO"], [IsoChronology::INSTANCE(), null, $ld, "2008::::ISO"], [IsoChronology::INSTANCE(), null, $lt, ":11:::ISO"], [IsoChronology::INSTANCE(), null, $ldt, "2008:11:::ISO"], [IsoChronology::INSTANCE(), null, $ot, ":11:+01:00::ISO"], [IsoChronology::INSTANCE(), null, $odt, "2008:11:+01:00::ISO"], [IsoChronology::INSTANCE(), null, $zdt, "2008:11:+02:00:Europe/Paris:ISO"], [IsoChronology::INSTANCE(), null, $instant, "::::ISO"], [null, self::ZONE_PARIS(), DayOfWeek::MONDAY(), ":::Europe/Paris:"], [null, self::ZONE_PARIS(), $ym, "2008:::Europe/Paris:ISO"], [null, self::ZONE_PARIS(), $ld, "2008:::Europe/Paris:ISO"], [null, self::ZONE_PARIS(), $lt, ":11::Europe/Paris:"], [null, self::ZONE_PARIS(), $ldt, "2008:11::Europe/Paris:ISO"], [null, self::ZONE_PARIS(), $ot, ":11:+01:00:Europe/Paris:"], [null, self::ZONE_PARIS(), $odt, "2008:12:+02:00:Europe/Paris:ISO"], [null, self::ZONE_PARIS(), $zdt, "2008:11:+02:00:Europe/Paris:ISO"], [null, self::ZONE_PARIS(), $instant, "1970:02:+01:00:Europe/Paris:ISO"], [null, self::OFFSET_PTHREE(), DayOfWeek::MONDAY(), ":::+03:00:"], [null, self::OFFSET_PTHREE(), $ym, "2008:::+03:00:ISO"], [null, self::OFFSET_PTHREE(), $ld, "2008:::+03:00:ISO"], [null, self::OFFSET_PTHREE(), $lt, ":11::+03:00:"], [null, self::OFFSET_PTHREE(), $ldt, "2008:11::+03:00:ISO"], [null, self::OFFSET_PTHREE(), $ot, null], [null, self::OFFSET_PTHREE(), $odt, "2008:13:+03:00:+03:00:ISO"], [null, self::OFFSET_PTHREE(), $zdt, "2008:12:+03:00:+03:00:ISO"], [null, self::OFFSET_PTHREE(), $instant, "1970:04:+03:00:+03:00:ISO"], [ThaiBuddhistChronology::INSTANCE(), null, DayOfWeek::MONDAY(), null], [ThaiBuddhistChronology::INSTANCE(), null, $ym, null], [ThaiBuddhistChronology::INSTANCE(), null, $ld, "2551::::ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, $lt, ":11:::ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, $ldt, "2551:11:::ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, $ot, ":11:+01:00::ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, $odt, "2551:11:+01:00::ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, $zdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, $instant, "::::ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), null, DayOfWeek::MONDAY(), null], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $ym, null], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $ld, "2551:::Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $lt, ":11::Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $ldt, "2551:11::Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $ot, ":11:+01:00:Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $odt, "2551:12:+02:00:Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $zdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $instant, "2513:02:+01:00:Europe/Paris:ThaiBuddhist"], [null, self::ZONE_PARIS(), $thaiZdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"], [ThaiBuddhistChronology::INSTANCE(), self::ZONE_PARIS(), $thaiZdt, "2551:11:+02:00:Europe/Paris:ThaiBuddhist"], [IsoChronology::INSTANCE(), self::ZONE_PARIS(), $thaiZdt, "2008:11:+02:00:Europe/Paris:ISO"]]; }
private function ym($year, $month) { return YearMonth::of($year, $month); }
/** * Combines this year with a month to create a {@code YearMonth}. * <p> * This returns a {@code YearMonth} formed from this year and the specified month. * All possible combinations of year and month are valid. * <p> * This method can be used as part of a chain to produce a date: * <pre> * LocalDate date = year.atMonth(month).atDay(day); * </pre> * * @param int $month the month-of-year to use, from 1 (January) to 12 (December) * @return YearMonth Year the year-month formed from this year and the specified month, not null * @throws DateTimeException if the month is invalid */ public function atMonthNumerical($month) { return YearMonth::of($this->year, $month); }
public function test_padOptional() { $this->builder->appendValue(ChronoField::MONTH_OF_YEAR())->appendLiteral(':')->padNext(5)->optionalStart()->appendValue(ChronoField::DAY_OF_MONTH())->optionalEnd()->appendLiteral(':')->appendValue(ChronoField::YEAR()); $this->assertEquals($this->builder->toFormatter()->format(LocalDate::of(2013, 2, 1)), "2: 1:2013"); $this->assertEquals($this->builder->toFormatter()->format(YearMonth::of(2013, 2)), "2: :2013"); }
public function test_atMonth_int() { $test = Year::of(2008); $this->assertEquals($test->atMonthNumerical(6), YearMonth::of(2008, 6)); }
/** * @expectedException \Celest\DateTimeException */ public function test_print_rfc1123_missingField() { $test = YearMonth::of(2008, 6); DateTimeFormatter::RFC_1123_DATE_TIME()->format($test); }