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

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

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

LocalDateTime.getLocalMillis介绍

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

代码示例

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

/**
 * Sets this field in a copy of the LocalDateTime.
 * <p>
 * The LocalDateTime 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 LocalDateTime with the field value changed
 * @throws IllegalArgumentException if the value isn't valid
 */
public LocalDateTime setCopy(int value) {
  return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), value));
}

代码示例来源: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 datetime with the minute of hour field updated.
 * <p>
 * LocalDateTime 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 LocalDateTime withMinuteOfHour(int minute) {
  return withLocalMillis(getChronology().minuteOfHour().set(getLocalMillis(), minute));
}

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

/**
 * Returns a copy of this datetime with the partial set of fields
 * replacing those from this instance.
 * <p>
 * For example, if the partial is a <code>TimeOfDay</code> then the time fields
 * would be changed in the returned instance.
 * If the partial is null, then <code>this</code> is returned.
 *
 * @param partial  the partial set of fields to apply to this datetime, null ignored
 * @return a copy of this datetime with a different set of fields
 * @throws IllegalArgumentException if any value is invalid
 */
public LocalDateTime withFields(ReadablePartial partial) {
  if (partial == null) {
    return this;
  }
  return withLocalMillis(getChronology().set(partial, getLocalMillis()));
}

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

/**
 * Adds to this field in a copy of this LocalDateTime.
 * <p>
 * The LocalDateTime 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 LocalDateTime with the field value changed
 * @throws IllegalArgumentException if the value isn't valid
 */
public LocalDateTime addToCopy(int value) {
  return iInstant.withLocalMillis(iField.add(iInstant.getLocalMillis(), value));
}

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

/**
 * Converts this object to a LocalTime with the same time and chronology.
 *
 * @return a LocalTime with the same time and chronology
 */
public LocalTime toLocalTime() {
  return new LocalTime(getLocalMillis(), getChronology());
}

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

/**
 * Returns a copy of this datetime with the year of century field updated.
 * <p>
 * LocalDateTime 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 LocalDateTime withYearOfCentury(int yearOfCentury) {
  return withLocalMillis(getChronology().yearOfCentury().set(getLocalMillis(), yearOfCentury));
}

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

/**
 * Returns a copy of this datetime with the partial set of fields
 * replacing those from this instance.
 * <p>
 * For example, if the partial is a <code>TimeOfDay</code> then the time fields
 * would be changed in the returned instance.
 * If the partial is null, then <code>this</code> is returned.
 *
 * @param partial  the partial set of fields to apply to this datetime, null ignored
 * @return a copy of this datetime with a different set of fields
 * @throws IllegalArgumentException if any value is invalid
 */
public LocalDateTime withFields(ReadablePartial partial) {
  if (partial == null) {
    return this;
  }
  return withLocalMillis(getChronology().set(partial, getLocalMillis()));
}

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

/**
 * Sets this field in a copy of the LocalDateTime to a parsed text value.
 * <p>
 * The LocalDateTime attached to this property is unchanged by this call.
 *
 * @param text  the text value to set
 * @param locale  optional locale to use for selecting a text symbol
 * @return a copy of the LocalDateTime with the field value changed
 * @throws IllegalArgumentException if the text value isn't valid
 */
public LocalDateTime setCopy(String text, Locale locale) {
  return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), text, locale));
}

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

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

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

/**
 * Returns a copy of this datetime with the month of year field updated.
 * <p>
 * LocalDateTime 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 LocalDateTime withMonthOfYear(int monthOfYear) {
  return withLocalMillis(getChronology().monthOfYear().set(getLocalMillis(), monthOfYear));
}

代码示例来源: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 datetime with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 *
 * @param durationToAdd  the duration 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 datetime with the duration added
 * @throws ArithmeticException if the result exceeds the internal capacity
 */
public LocalDateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) {
  if (durationToAdd == null || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getLocalMillis(), durationToAdd.getMillis(), scalar);
  return withLocalMillis(instant);
}

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

/**
 * Sets this field in a copy of the LocalDateTime.
 * <p>
 * The LocalDateTime 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 LocalDateTime with the field value changed
 * @throws IllegalArgumentException if the value isn't valid
 */
public LocalDateTime setCopy(int value) {
  return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), value));
}

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

/**
 * Adds to this field in a copy of this LocalDateTime.
 * <p>
 * The LocalDateTime 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 LocalDateTime with the field value changed
 * @throws IllegalArgumentException if the value isn't valid
 */
public LocalDateTime addToCopy(long value) {
  return iInstant.withLocalMillis(iField.add(iInstant.getLocalMillis(), value));
}

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

/**
 * Returns a copy of this datetime with the hour of day field updated.
 * <p>
 * LocalDateTime 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 LocalDateTime withHourOfDay(int hour) {
  return withLocalMillis(getChronology().hourOfDay().set(getLocalMillis(), hour));
}

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

/**
 * Returns a copy of this datetime with the specified duration added.
 * <p>
 * If the addition is zero, then <code>this</code> is returned.
 *
 * @param durationToAdd  the duration 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 datetime with the duration added
 * @throws ArithmeticException if the result exceeds the internal capacity
 */
public LocalDateTime withDurationAdded(ReadableDuration durationToAdd, int scalar) {
  if (durationToAdd == null || scalar == 0) {
    return this;
  }
  long instant = getChronology().add(getLocalMillis(), durationToAdd.getMillis(), scalar);
  return withLocalMillis(instant);
}

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

/**
 * Sets this field in a copy of the LocalDateTime to a parsed text value.
 * <p>
 * The LocalDateTime attached to this property is unchanged by this call.
 *
 * @param text  the text value to set
 * @param locale  optional locale to use for selecting a text symbol
 * @return a copy of the LocalDateTime with the field value changed
 * @throws IllegalArgumentException if the text value isn't valid
 */
public LocalDateTime setCopy(String text, Locale locale) {
  return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), text, locale));
}

相关文章