Home | History | Annotate | Download | only in time

Lines Matching refs:month

91  * A month-day in the ISO-8601 calendar system, such as {@code --12-03}.
94 * of a month and day-of-month. Any field that can be derived from a month and day,
139 * The month-of-year, not null.
141 private final int month;
143 * The day-of-month.
149 * Obtains the current month-day from the system clock in the default time-zone.
152 * time-zone to obtain the current month-day.
157 * @return the current month-day using the system clock and default time-zone, not null
164 * Obtains the current month-day from the system clock in the specified time-zone.
166 * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day.
173 * @return the current month-day using the system clock, not null
180 * Obtains the current month-day from the specified clock.
182 * This will query the specified clock to obtain the current month-day.
187 * @return the current month-day, not null
198 * The day-of-month must be valid for the month within a leap year.
203 * February 29th is permitted, as that month-day can sometimes be valid.
205 * @param month the month-of-year to represent, not null
206 * @param dayOfMonth the day-of-month to represent, from 1 to 31
207 * @return the month-day, not null
209 * or if the day-of-month is invalid for the month
211 public static MonthDay of(Month month, int dayOfMonth) {
212 Objects.requireNonNull(month, "month");
214 if (dayOfMonth > month.maxLength()) {
216 " is not valid for month " + month.name());
218 return new MonthDay(month.getValue(), dayOfMonth);
224 * The day-of-month must be valid for the month within a leap year.
225 * Hence, for month 2 (February), day 29 is valid.
227 * For example, passing in month 4 (April) and day 31 will throw an exception, as
229 * February 29th is permitted, as that month-day can sometimes be valid.
231 * @param month the month-of-year to represent, from 1 (January) to 12 (December)
232 * @param dayOfMonth the day-of-month to represent, from 1 to 31
233 * @return the month-day, not null
235 * or if the day-of-month is invalid for the month
237 public static MonthDay of(int month, int dayOfMonth) {
238 return of(Month.of(month), dayOfMonth);
245 * This obtains a month-day based on the specified temporal.
258 * @return the month-day, not null
280 * The string must represent a valid month-day.
284 * @return the parsed month-day, not null
294 * The text is parsed using the formatter, returning a month-day.
298 * @return the parsed month-day, not null
310 * @param month the month-of-year to represent, validated from 1 to 12
311 * @param dayOfMonth the day-of-month to represent, validated from 1 to 29-31
313 private MonthDay(int month, int dayOfMonth) {
314 this.month = month;
322 * This checks if this month-day can be queried for the specified field.
340 * @return true if the field is supported on this month-day, false if not
354 * This month-day is used to enhance the accuracy of the returned range.
384 * Gets the value of the specified field from this month-day as an {@code int}.
386 * This queries this month-day for the value of the specified field.
393 * values based on this month-day.
415 * Gets the value of the specified field from this month-day as a {@code long}.
417 * This queries this month-day for the value of the specified field.
423 * values based on this month-day.
443 case MONTH_OF_YEAR: return month;
452 * Gets the month-of-year field from 1 to 12.
454 * This method returns the month as an {@code int} from 1 to 12.
455 * Application code is frequently clearer if the enum {@link Month}
458 * @return the month-of-year, from 1 to 12
462 return month;
466 * Gets the month-of-year field using the {@code Month} enum.
468 * This method returns the enum {@link Month} for the month.
471 * provides the {@link Month#getValue() int value}.
473 * @return the month-of-year, not null
476 public Month getMonth() {
477 return Month.of(month);
481 * Gets the day-of-month field.
483 * This method returns the primitive {@code int} value for the day-of-month.
485 * @return the day-of-month, from 1 to 31
493 * Checks if the year is valid for this month-day.
495 * This method checks whether this month and day and the input year form
499 * @return true if the year is valid for this month-day
503 return (day == 29 && month == 2 && Year.isLeap(year) == false) == false;
508 * Returns a copy of this {@code MonthDay} with the month-of-year altered.
510 * This returns a month-day with the specified month.
511 * If the day-of-month is invalid for the specified month, the day will
512 * be adjusted to the last valid day-of-month.
516 * @param month the month-of-year to set in the returned month-day, from 1 (January) to 12 (December)
517 * @return a {@code MonthDay} based on this month-day with the requested month, not null
518 * @throws DateTimeException if the month-of-year value is invalid
520 public MonthDay withMonth(int month) {
521 return with(Month.of(month));
525 * Returns a copy of this {@code MonthDay} with the month-of-year altered.
527 * This returns a month-day with the specified month.
528 * If the day-of-month is invalid for the specified month, the day will
529 * be adjusted to the last valid day-of-month.
533 * @param month the month-of-year to set in the returned month-day, not null
534 * @return a {@code MonthDay} based on this month-day with the requested month, not null
536 public MonthDay with(Month month) {
537 Objects.requireNonNull(month, "month");
538 if (month.getValue() == this.month) {
541 int day = Math.min(this.day, month.maxLength());
542 return new MonthDay(month.getValue(), day);
546 * Returns a copy of this {@code MonthDay} with the day-of-month altered.
548 * This returns a month-day with the specified day-of-month.
549 * If the day-of-month is invalid for the month, an exception is thrown.
553 * @param dayOfMonth the day-of-month to set in the return month-day, from 1 to 31
554 * @return a {@code MonthDay} based on this month-day with the requested day, not null
555 * @throws DateTimeException if the day-of-month value is invalid,
556 * or if the day-of-month is invalid for the month
562 return of(month, dayOfMonth);
567 * Queries this month-day using the specified query.
569 * This queries this month-day using the specified query strategy object.
594 * Adjusts the specified temporal object to have this month-day.
597 * with the month and day-of-month changed to be the same as this.
625 temporal = temporal.with(MONTH_OF_YEAR, month);
630 * Formats this month-day using the specified formatter.
632 * This month-day will be passed to the formatter to produce a string.
635 * @return the formatted month-day string, not null
645 * Combines this month-day with a year to create a {@code LocalDate}.
647 * This returns a {@code LocalDate} formed from this month-day and the specified year.
649 * A month-day of February 29th will be adjusted to February 28th in the resulting
655 * @return the local date formed from this month-day and the specified year, not null
659 return LocalDate.of(year, month, isValidYear(year) ? day : 28);
664 * Compares this month-day to another month-day.
666 * The comparison is based first on value of the month, then on the value of the day.
669 * @param other the other month-day to compare to, not null
674 int cmp = (month - other.month);
682 * Checks if this month-day is after the specified month-day.
684 * @param other the other month-day to compare to, not null
685 * @return true if this is after the specified month-day
692 * Checks if this month-day is before the specified month-day.
694 * @param other the other month-day to compare to, not null
695 * @return true if this point is before the specified month-day
703 * Checks if this month-day is equal to another month-day.
705 * The comparison is based on the time-line position of the month-day within a year.
708 * @return true if this is equal to the other month-day
717 return month == other.month && day == other.day;
723 * A hash code for this month-day.
729 return (month << 6) + day;
734 * Outputs this month-day as a {@code String}, such as {@code --12-03}.
738 * @return a string representation of this month-day, not null
743 .append(month < 10 ? "0" : "").append(month)
755 * out.writeByte(month);
776 out.writeByte(month);
781 byte month = in.readByte();
783 return MonthDay.of(month, day);