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

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

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

LocalTime.getChronology介绍

[英]Gets the chronology of the time.
[中]获取时间的年表。

代码示例

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

/**
 * Returns a copy of this time 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 time with different millis
 */
LocalTime withLocalMillis(long newMillis) {
  return (newMillis == getLocalMillis() ? this : new LocalTime(newMillis, getChronology()));
}

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

/**
 * Returns a copy of this time with the partial set of fields replacing
 * those from this instance.
 * <p>
 * For example, if the partial contains an hour and minute 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 time, null ignored
 * @return a copy of this time with a different set of fields
 * @throws IllegalArgumentException if any value is invalid
 */
public LocalTime withFields(ReadablePartial partial) {
  if (partial == null) {
    return this;
  }
  return withLocalMillis(getChronology().set(partial, getLocalMillis()));
}

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

/**
 * Returns a copy of this time with the specified period added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * <p>
 * This method is typically used to add multiple copies of complex
 * period instances. Adding one field is best achieved using methods
 * like {@link #withFieldAdded(DurationFieldType, int)}
 * or {@link #plusHours(int)}.
 *
 * @param period  the period to add to this one, null means zero
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this time with the period added
 * @throws ArithmeticException if the result exceeds the internal capacity
 */
public LocalTime withPeriodAdded(ReadablePeriod period, int scalar) {
  if (period == null || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(period, getLocalMillis(), scalar);
  return withLocalMillis(instant);
}

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

/**
 * Returns a copy of this time 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 time with different millis
 */
LocalTime withLocalMillis(long newMillis) {
  return (newMillis == getLocalMillis() ? this : new LocalTime(newMillis, getChronology()));
}

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

/**
 * Returns a copy of this time with the partial set of fields replacing
 * those from this instance.
 * <p>
 * For example, if the partial contains an hour and minute 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 time, null ignored
 * @return a copy of this time with a different set of fields
 * @throws IllegalArgumentException if any value is invalid
 */
public LocalTime withFields(ReadablePartial partial) {
  if (partial == null) {
    return this;
  }
  return withLocalMillis(getChronology().set(partial, getLocalMillis()));
}

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

/**
 * Get the hour of day field value.
 *
 * @return the hour of day
 */
public int getHourOfDay() {
  return getChronology().hourOfDay().get(getLocalMillis());
}

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

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

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

/**
 * Get the minute of hour field value.
 *
 * @return the minute of hour
 */
public int getMinuteOfHour() {
  return getChronology().minuteOfHour().get(getLocalMillis());
}

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

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

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

/**
 * Get the millis of day field value.
 *
 * @return the millis of day
 */
public int getMillisOfDay() {
  return getChronology().millisOfDay().get(getLocalMillis());
}

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

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

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

/**
 * Get the second of minute field value.
 *
 * @return the second of minute
 */
public int getSecondOfMinute() {
  return getChronology().secondOfMinute().get(getLocalMillis());
}

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

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

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

/**
 * Get the millis of second field value.
 *
 * @return the millis of second
 */
public int getMillisOfSecond() {
  return getChronology().millisOfSecond().get(getLocalMillis());
}

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

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

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

/**
 * Get the millis of second field value.
 *
 * @return the millis of second
 */
public int getMillisOfSecond() {
  return getChronology().millisOfSecond().get(getLocalMillis());
}

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

/**
 * Returns a copy of this time with the specified period added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 * <p>
 * This method is typically used to add multiple copies of complex
 * period instances. Adding one field is best achieved using methods
 * like {@link #withFieldAdded(DurationFieldType, int)}
 * or {@link #plusHours(int)}.
 *
 * @param period  the period to add to this one, null means zero
 * @param scalar  the amount of times to add, such as -1 to subtract once
 * @return a copy of this time with the period added
 * @throws ArithmeticException if the result exceeds the internal capacity
 */
public LocalTime withPeriodAdded(ReadablePeriod period, int scalar) {
  if (period == null || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(period, getLocalMillis(), scalar);
  return withLocalMillis(instant);
}

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

/**
 * Get the hour of day field value.
 *
 * @return the hour of day
 */
public int getHourOfDay() {
  return getChronology().hourOfDay().get(getLocalMillis());
}

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

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

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

/**
 * Get the millis of day field value.
 *
 * @return the millis of day
 */
public int getMillisOfDay() {
  return getChronology().millisOfDay().get(getLocalMillis());
}

相关文章