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

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

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

LocalTime.getLocalMillis介绍

[英]Gets the local milliseconds from the Java epoch of 1970-01-01T00:00:00 (not fixed to any specific time zone).
[中]获取Java纪元1970-01-01T00:00:00(不固定到任何特定时区)的本地毫秒数。

代码示例

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

/**
 * Rounds to the nearest whole unit of this field on a copy of this
 * LocalTime, favoring the floor if halfway.
 *
 * @return a copy of the LocalTime with the field value changed
 */
public LocalTime roundHalfFloorCopy() {
  return iInstant.withLocalMillis(iField.roundHalfFloor(iInstant.getLocalMillis()));
}

代码示例来源: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: joda-time/joda-time

/**
 * Adds to this field in a copy of this LocalTime.
 * <p>
 * The LocalTime attached to this property is unchanged by this call.
 *
 * @param value  the value to add to the field in the copy
 * @return a copy of the LocalTime with the field value changed
 */
public LocalTime addCopy(int value) {
  return iInstant.withLocalMillis(iField.add(iInstant.getLocalMillis(), value));
}

代码示例来源: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

/**
 * Sets this field in a copy of the LocalTime.
 * <p>
 * The LocalTime attached to this property is unchanged by this call.
 *
 * @param value  the value to set the field in the copy to
 * @return a copy of the LocalTime with the field value changed
 * @throws IllegalArgumentException if the value isn't valid
 */
public LocalTime setCopy(int value) {
  return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), value));
}

代码示例来源: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

/**
 * Rounds to the nearest whole unit of this field on a copy of this
 * LocalTime, favoring the ceiling if halfway.
 *
 * @return a copy of the LocalTime with the field value changed
 */
public LocalTime roundHalfCeilingCopy() {
  return iInstant.withLocalMillis(iField.roundHalfCeiling(iInstant.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 day field value.
 *
 * @return the millis of day
 */
public int getMillisOfDay() {
  return getChronology().millisOfDay().get(getLocalMillis());
}

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

/**
   * Rounds to the nearest whole unit of this field on a copy of this
   * LocalTime.  If halfway, the ceiling is favored over the floor
   * only if it makes this field's value even.
   *
   * @return a copy of the LocalTime with the field value changed
   */
  public LocalTime roundHalfEvenCopy() {
    return iInstant.withLocalMillis(iField.roundHalfEven(iInstant.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 second of minute field value.
 *
 * @return the second of minute
 */
public int getSecondOfMinute() {
  return getChronology().secondOfMinute().get(getLocalMillis());
}

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

/**
 * Rounds to the highest whole unit of this field on a copy of this
 * LocalTime.
 * <p>
 * For example, rounding floor on the hourOfDay field of a LocalTime
 * where the time is 10:30 would result in new LocalTime with the
 * time of 11:00.
 *
 * @return a copy of the LocalTime with the field value changed
 */
public LocalTime roundCeilingCopy() {
  return iInstant.withLocalMillis(iField.roundCeiling(iInstant.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: joda-time/joda-time

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

相关文章