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

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

本文整理了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

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

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

/**
 * Returns a copy of this year-month with the new year and month, checking
 * to see if a new object is in fact required.
 *
 * @param newYear  the year to represent, validated from MIN_YEAR to MAX_YEAR
 * @param newMonth  the month-of-year to represent, validated not null
 * @return the year-month, not null
 */
private YearMonth with(int newYear, int newMonth) {
  if (year == newYear && month == newMonth) {
    return this;
  }
  return new YearMonth(newYear, newMonth);
}

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

/**
 * Returns a copy of this year-month with the new year and month, checking
 * to see if a new object is in fact required.
 *
 * @param newYear  the year to represent, validated from MIN_YEAR to MAX_YEAR
 * @param newMonth  the month-of-year to represent, validated not null
 * @return the year-month, not null
 */
private YearMonth with(int newYear, int newMonth) {
  if (year == newYear && month == newMonth) {
    return this;
  }
  return new YearMonth(newYear, newMonth);
}

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

import org.joda.time.YearMonth;
import java.util.Locale;

public class X {

  public static void main(String[] s){
    for (int i = 1;i<13; i++) {
      YearMonth md = new YearMonth(1992, i);
      System.out.println(md.monthOfYear().getAsText(new Locale("ru")));
    }
  }
}

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

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

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

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

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

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

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

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

代码示例来源: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, from 1 (January) to 12 (December)
 * @return the year-month, not null
 * @throws DateTimeException if either field value is invalid
 */
public static YearMonth of(int year, int month) {
  YEAR.checkValidValue(year);
  MONTH_OF_YEAR.checkValidValue(month);
  return new YearMonth(year, month);
}

代码示例来源: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, from 1 (January) to 12 (December)
 * @return the year-month, not null
 * @throws DateTimeException if either field value is invalid
 */
public static YearMonth of(int year, int month) {
  YEAR.checkValidValue(year);
  MONTH_OF_YEAR.checkValidValue(month);
  return new YearMonth(year, month);
}

相关文章