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

x33g5p2x  于2022-02-05 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(132)

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

YearMonth.<init>介绍

[英]Constructor.
[中]建造师。

代码示例

代码示例来源:origin: stackoverflow.com

  1. val yearMonth = new YearMonth();
  2. val formatter = DateTimeFormat.forPattern("yyyyMM");
  3. val dates = (0 to 5).map {
  4. i=>formatter.print(yearMonth.plusMonths(i)).toInt
  5. }.toList

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

  1. /**
  2. * Returns a copy of this year-month with the new year and month, checking
  3. * to see if a new object is in fact required.
  4. *
  5. * @param newYear the year to represent, validated from MIN_YEAR to MAX_YEAR
  6. * @param newMonth the month-of-year to represent, validated not null
  7. * @return the year-month, not null
  8. */
  9. private YearMonth with(int newYear, int newMonth) {
  10. if (year == newYear && month == newMonth) {
  11. return this;
  12. }
  13. return new YearMonth(newYear, newMonth);
  14. }

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

  1. /**
  2. * Returns a copy of this year-month with the new year and month, checking
  3. * to see if a new object is in fact required.
  4. *
  5. * @param newYear the year to represent, validated from MIN_YEAR to MAX_YEAR
  6. * @param newMonth the month-of-year to represent, validated not null
  7. * @return the year-month, not null
  8. */
  9. private YearMonth with(int newYear, int newMonth) {
  10. if (year == newYear && month == newMonth) {
  11. return this;
  12. }
  13. return new YearMonth(newYear, newMonth);
  14. }

代码示例来源:origin: stackoverflow.com

  1. import org.joda.time.YearMonth;
  2. import java.util.Locale;
  3. public class X {
  4. public static void main(String[] s){
  5. for (int i = 1;i<13; i++) {
  6. YearMonth md = new YearMonth(1992, i);
  7. System.out.println(md.monthOfYear().getAsText(new Locale("ru")));
  8. }
  9. }
  10. }

代码示例来源:origin: stackoverflow.com

  1. YearMonth ym = new YearMonth();
  2. dt = ym.toDateTime(null);
  3. System.out.println(dt.dayOfMonth().getMaximumValue());

代码示例来源:origin: stackoverflow.com

  1. YearMonth yearMonth = new YearMonth();
  2. yearMonth.toLocalDate(1).dayOfMonth().getMaximumValue();

代码示例来源:origin: stackoverflow.com

  1. new LocalDateTime(1980, 1, 1, 0, 0).withFields(new YearMonth(2014, 1))

代码示例来源:origin: stackoverflow.com

  1. YearMonth yearMonth = new YearMonth (1970, 1);
  2. Interval interval = yearMonth.toInterval(DateTimeZone.UTC);
  3. int startSSE = (int) TimeUnit.MILLISECONDS.toSeconds(interval.getStartMillis());
  4. int endSSE = (int) TimeUnit.MILLISECONDS.toSeconds(interval.getEndMillis());
  5. System.out.printf("%d -> %d (%4.6f days)\n", startSSE, endSSE, ((float)(endSSE-startSSE))/(24*60*60));

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

  1. /**
  2. * Obtains an instance of {@code YearMonth} from a year and month.
  3. *
  4. * @param year the year to represent, from MIN_YEAR to MAX_YEAR
  5. * @param month the month-of-year to represent, from 1 (January) to 12 (December)
  6. * @return the year-month, not null
  7. * @throws DateTimeException if either field value is invalid
  8. */
  9. public static YearMonth of(int year, int month) {
  10. YEAR.checkValidValue(year);
  11. MONTH_OF_YEAR.checkValidValue(month);
  12. return new YearMonth(year, month);
  13. }

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

  1. /**
  2. * Obtains an instance of {@code YearMonth} from a year and month.
  3. *
  4. * @param year the year to represent, from MIN_YEAR to MAX_YEAR
  5. * @param month the month-of-year to represent, from 1 (January) to 12 (December)
  6. * @return the year-month, not null
  7. * @throws DateTimeException if either field value is invalid
  8. */
  9. public static YearMonth of(int year, int month) {
  10. YEAR.checkValidValue(year);
  11. MONTH_OF_YEAR.checkValidValue(month);
  12. return new YearMonth(year, month);
  13. }

相关文章