org.joda.time.LocalDate.getChronology()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(165)

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

LocalDate.getChronology介绍

[英]Gets the chronology of the date.
[中]获取日期的时间顺序。

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the partial set of fields replacing
 * those from this instance.
 * <p>
 * For example, if the partial contains a year and a month then those two
 * fields will be changed in the returned instance.
 * Unsupported fields are ignored.
 * If the partial is null, then <code>this</code> is returned.
 *
 * @param partial  the partial set of fields to apply to this date, null ignored
 * @return a copy of this date with a different set of fields
 * @throws IllegalArgumentException if any value is invalid
 */
public LocalDate withFields(ReadablePartial partial) {
  if (partial == null) {
    return this;
  }
  return withLocalMillis(getChronology().set(partial, getLocalMillis()));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the era field value.
 *
 * @return the era
 */
public int getEra() {
  return getChronology().era().get(getLocalMillis());
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Returns a copy of this date with the partial set of fields replacing
 * those from this instance.
 * <p>
 * For example, if the partial contains a year and a month then those two
 * fields will be changed in the returned instance.
 * Unsupported fields are ignored.
 * If the partial is null, then <code>this</code> is returned.
 *
 * @param partial  the partial set of fields to apply to this date, null ignored
 * @return a copy of this date with a different set of fields
 * @throws IllegalArgumentException if any value is invalid
 */
public LocalDate withFields(ReadablePartial partial) {
  if (partial == null) {
    return this;
  }
  return withLocalMillis(getChronology().set(partial, getLocalMillis()));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the year of century field value.
 *
 * @return the year of century
 */
public int getYearOfCentury() {
  return getChronology().yearOfCentury().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the year field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * year changed.
 *
 * @param year  the year to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withYear(int year) {
  return withLocalMillis(getChronology().year().set(getLocalMillis(), year));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the day of month field value.
 * <p>
 * The values for the day of month are defined in {@link org.joda.time.DateTimeConstants}.
 *
 * @return the day of month
 */
public int getDayOfMonth() {
  return getChronology().dayOfMonth().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the day of year field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * day of year changed.
 *
 * @param dayOfYear  the day of year to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withDayOfYear(int dayOfYear) {
  return withLocalMillis(getChronology().dayOfYear().set(getLocalMillis(), dayOfYear));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the year field value.
 *
 * @return the year
 */
public int getYear() {
  return getChronology().year().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the era field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * era changed.
 *
 * @param era  the era to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withEra(int era) {
  return withLocalMillis(getChronology().era().set(getLocalMillis(), era));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the year of era field value.
 *
 * @return the year of era
 */
public int getCenturyOfEra() {
  return getChronology().centuryOfEra().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the day of month field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * day of month changed.
 *
 * @param dayOfMonth  the day of month to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withDayOfMonth(int dayOfMonth) {
  return withLocalMillis(getChronology().dayOfMonth().set(getLocalMillis(), dayOfMonth));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the day of year field value.
 *
 * @return the day of year
 */
public int getDayOfYear() {
  return getChronology().dayOfYear().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the century of era field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * century of era changed.
 *
 * @param centuryOfEra  the century of era to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withCenturyOfEra(int centuryOfEra) {
  return withLocalMillis(getChronology().centuryOfEra().set(getLocalMillis(), centuryOfEra));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the day of week field value.
 * <p>
 * The values for the day of week are defined in {@link org.joda.time.DateTimeConstants}.
 *
 * @return the day of week
 */
public int getDayOfWeek() {
  return getChronology().dayOfWeek().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the year of era field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * year of era changed.
 *
 * @param yearOfEra  the year of era to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withYearOfEra(int yearOfEra) {
  return withLocalMillis(getChronology().yearOfEra().set(getLocalMillis(), yearOfEra));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the year of era field value.
 *
 * @return the year of era
 */
public int getYearOfEra() {
  return getChronology().yearOfEra().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the year of century field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * year of century changed.
 *
 * @param yearOfCentury  the year of century to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withYearOfCentury(int yearOfCentury) {
  return withLocalMillis(getChronology().yearOfCentury().set(getLocalMillis(), yearOfCentury));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Get the month of year field value.
 *
 * @return the month of year
 */
public int getMonthOfYear() {
  return getChronology().monthOfYear().get(getLocalMillis());
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with the month of year field updated.
 * <p>
 * LocalDate is immutable, so there are no set methods.
 * Instead, this method returns a new instance with the value of
 * month of year changed.
 *
 * @param monthOfYear  the month of year to set
 * @return a copy of this object with the field set
 * @throws IllegalArgumentException if the value is invalid
 */
public LocalDate withMonthOfYear(int monthOfYear) {
  return withLocalMillis(getChronology().monthOfYear().set(getLocalMillis(), monthOfYear));
}

代码示例来源:origin: joda-time/joda-time

/**
 * Returns a copy of this date with different local millis.
 * <p>
 * The returned object will be a new instance of the same type.
 * Only the millis will change, the chronology is kept.
 * The returned object will be either be a new instance or <code>this</code>.
 *
 * @param newMillis  the new millis, from 1970-01-01T00:00:00
 * @return a copy of this date with different millis
 */
LocalDate withLocalMillis(long newMillis) {
  newMillis = iChronology.dayOfMonth().roundFloor(newMillis);
  return (newMillis == getLocalMillis() ? this : new LocalDate(newMillis, getChronology()));
}

相关文章