本文整理了Java中org.joda.time.LocalTime.withLocalMillis()
方法的一些代码示例,展示了LocalTime.withLocalMillis()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalTime.withLocalMillis()
方法的具体详情如下:
包路径:org.joda.time.LocalTime
类名称:LocalTime
方法名:withLocalMillis
[英]Returns a copy of this time with different local millis.
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 this
.
[中]返回具有不同本地毫秒数的此时间的副本。
返回的对象将是相同类型的新实例。只有米利会改变,年表会保留下来。返回的对象将是新实例或this
。
代码示例来源: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 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: 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
/**
* 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
/**
* 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
/**
* 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
/**
* 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 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: JodaOrg/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: 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
/**
* 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: 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
/**
* 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: 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
/**
* 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()));
}
}
内容来源于网络,如有侵权,请联系作者删除!