类的用途
java.time.YearMonth
使用 YearMonth 的包
-
YearMonth 在 java.time 中的用法
修饰符和类型方法描述Year.atMonth(int month) 将今年与一个月结合起来创建一个YearMonth。将今年与一个月结合起来创建一个YearMonth。static YearMonthYearMonth.from(TemporalAccessor temporal) 从时间对象中获取YearMonth的实例。YearMonth.minus(long amountToSubtract, TemporalUnit unit) 返回减去指定数量的今年-月份的副本。YearMonth.minus(TemporalAmount amountToSubtract) 返回减去指定数量的今年-月份的副本。YearMonth.minusMonths(long monthsToSubtract) 返回此YearMonth的副本,并减去指定的月数。YearMonth.minusYears(long yearsToSubtract) 返回此YearMonth的副本,并减去指定的年数。static YearMonthYearMonth.now()从默认时区的系统时钟获取当前年月。static YearMonth从指定时钟获取当前年月。static YearMonth从指定时区的系统时钟获取当前年月。static YearMonthYearMonth.of(int year, int month) 从年份和月份中获取YearMonth的实例。static YearMonth从年份和月份中获取YearMonth的实例。static YearMonthYearMonth.parse(CharSequence text) 从2007-12等文本字符串中获取YearMonth的实例。static YearMonthYearMonth.parse(CharSequence text, DateTimeFormatter formatter) 使用特定格式化程序从文本字符串中获取YearMonth的实例。YearMonth.plus(long amountToAdd, TemporalUnit unit) 返回添加了指定数量的今年-月份的副本。YearMonth.plus(TemporalAmount amountToAdd) 返回添加了指定数量的今年-月份的副本。YearMonth.plusMonths(long monthsToAdd) 返回此YearMonth的副本,并添加了指定的月数。YearMonth.plusYears(long yearsToAdd) 返回此YearMonth的副本,并添加了指定的年数。YearMonth.with(TemporalAdjuster adjuster) 返回今年-月份的调整副本。YearMonth.with(TemporalField field, long newValue) 返回此年月的副本,并将指定字段设置为新值。YearMonth.withMonth(int month) 返回此YearMonth的副本,其中更改了月份。YearMonth.withYear(int year) 返回此YearMonth的副本,并更改年份。