gpt4 book ai didi

org.threeten.bp.YearMonth.of()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 13:29:31 26 4
gpt4 key购买 nike

本文整理了Java中org.threeten.bp.YearMonth.of()方法的一些代码示例,展示了YearMonth.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YearMonth.of()方法的具体详情如下:
包路径:org.threeten.bp.YearMonth
类名称:YearMonth
方法名:of

YearMonth.of介绍

[英]Obtains an instance of YearMonth from a year and month.
[中]从年和月中获取YearMonth的实例。

代码示例

代码示例来源:origin: org.threeten/threetenbp

/**
 * 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 month  the month-of-year to use, not null
 * @return the year-month formed from this year and the specified month, not null
 */
public YearMonth atMonth(Month month) {
  return YearMonth.of(year, month);
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * 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 month  the month-of-year to use, from 1 (January) to 12 (December)
 * @return the year-month formed from this year and the specified month, not null
 * @throws DateTimeException if the month is invalid
 */
public YearMonth atMonth(int month) {
  return YearMonth.of(year, month);
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * 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 month  the month-of-year to use, from 1 (January) to 12 (December)
 * @return the year-month formed from this year and the specified month, not null
 * @throws DateTimeException if the month is invalid
 */
public YearMonth atMonth(int month) {
  return YearMonth.of(year, month);
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * 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 month  the month-of-year to use, not null
 * @return the year-month formed from this year and the specified month, not null
 */
public YearMonth atMonth(Month month) {
  return YearMonth.of(year, month);
}

代码示例来源:origin: org.threeten/threetenbp

static YearMonth readExternal(DataInput in) throws IOException {
  int year = in.readInt();
  byte month = in.readByte();
  return YearMonth.of(year, month);
}

代码示例来源:origin: ThreeTen/threetenbp

static YearMonth readExternal(DataInput in) throws IOException {
  int year = in.readInt();
  byte month = in.readByte();
  return YearMonth.of(year, month);
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Obtains an instance of {@code YearMonth} from a year and month.
 *
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param month  the month-of-year to represent, not null
 * @return the year-month, not null
 * @throws DateTimeException if the year value is invalid
 */
public static YearMonth of(int year, Month month) {
  Jdk8Methods.requireNonNull(month, "month");
  return of(year, month.getValue());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Obtains an instance of {@code YearMonth} from a year and month.
 *
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param month  the month-of-year to represent, not null
 * @return the year-month, not null
 * @throws DateTimeException if the year value is invalid
 */
public static YearMonth of(int year, Month month) {
  Jdk8Methods.requireNonNull(month, "month");
  return of(year, month.getValue());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Obtains the current year-month from the specified clock.
 * <p>
 * This will query the specified clock to obtain the current year-month.
 * Using this method allows the use of an alternate clock for testing.
 * The alternate clock may be introduced using {@link Clock dependency injection}.
 *
 * @param clock  the clock to use, not null
 * @return the current year-month, not null
 */
public static YearMonth now(Clock clock) {
  final LocalDate now = LocalDate.now(clock);  // called once
  return YearMonth.of(now.getYear(), now.getMonth());
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Obtains the current year-month from the specified clock.
 * <p>
 * This will query the specified clock to obtain the current year-month.
 * Using this method allows the use of an alternate clock for testing.
 * The alternate clock may be introduced using {@link Clock dependency injection}.
 *
 * @param clock  the clock to use, not null
 * @return the current year-month, not null
 */
public static YearMonth now(Clock clock) {
  final LocalDate now = LocalDate.now(clock);  // called once
  return YearMonth.of(now.getYear(), now.getMonth());
}

代码示例来源:origin: ThreeTen/threetenbp

temporal = LocalDate.from(temporal);
  return of(temporal.get(YEAR), temporal.get(MONTH_OF_YEAR));
} catch (DateTimeException ex) {
  throw new DateTimeException("Unable to obtain YearMonth from TemporalAccessor: " +

代码示例来源:origin: org.threeten/threetenbp

temporal = LocalDate.from(temporal);
  return of(temporal.get(YEAR), temporal.get(MONTH_OF_YEAR));
} catch (DateTimeException ex) {
  throw new DateTimeException("Unable to obtain YearMonth from TemporalAccessor: " +

代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp

"Expected array to end.");
return YearMonth.of(year, month);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com