本文整理了Java中org.joda.time.LocalDate.withLocalMillis()
方法的一些代码示例,展示了LocalDate.withLocalMillis()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.withLocalMillis()
方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:withLocalMillis
[英]Returns a copy of this date 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
.
[中]
代码示例来源:origin: joda-time/joda-time
/**
* Sets this field in a copy of the LocalDate.
* <p>
* The LocalDate 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 LocalDate with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public LocalDate setCopy(int value) {
return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), value));
}
代码示例来源: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: 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
/**
* Rounds to the nearest whole unit of this field on a copy of this
* LocalDate. If halfway, the ceiling is favored over the floor
* only if it makes this field's value even.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundHalfEvenCopy() {
return iInstant.withLocalMillis(iField.roundHalfEven(iInstant.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
/**
* Adds to this field in a copy of this LocalDate.
* <p>
* The LocalDate 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 LocalDate with the field value changed
* @throws IllegalArgumentException if the value isn't valid
*/
public LocalDate addToCopy(int value) {
return iInstant.withLocalMillis(iField.add(iInstant.getLocalMillis(), value));
}
代码示例来源: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
/**
* Rounds to the nearest whole unit of this field on a copy of this
* LocalDate, favoring the floor if halfway.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundHalfFloorCopy() {
return iInstant.withLocalMillis(iField.roundHalfFloor(iInstant.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
/**
* Rounds to the nearest whole unit of this field on a copy of this
* LocalDate, favoring the ceiling if halfway.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundHalfCeilingCopy() {
return iInstant.withLocalMillis(iField.roundHalfCeiling(iInstant.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: JodaOrg/joda-time
/**
* Rounds to the nearest whole unit of this field on a copy of this
* LocalDate, favoring the ceiling if halfway.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundHalfCeilingCopy() {
return iInstant.withLocalMillis(iField.roundHalfCeiling(iInstant.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
/**
* Rounds to the highest whole unit of this field on a copy of this
* LocalDate.
* <p>
* For example, rounding floor on the hourOfDay field of a LocalDate
* where the time is 10:30 would result in new LocalDate with the
* time of 11:00.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundCeilingCopy() {
return iInstant.withLocalMillis(iField.roundCeiling(iInstant.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
/**
* Sets this field in a copy of the LocalDate to a parsed text value.
* <p>
* The LocalDate 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 LocalDate with the field value changed
* @throws IllegalArgumentException if the text value isn't valid
*/
public LocalDate setCopy(String text, Locale locale) {
return iInstant.withLocalMillis(iField.set(iInstant.getLocalMillis(), text, locale));
}
代码示例来源: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
/**
* Rounds to the lowest whole unit of this field on a copy of this
* LocalDate.
* <p>
* For example, rounding floor on the hourOfDay field of a LocalDate
* where the time is 10:30 would result in new LocalDate with the
* time of 10:00.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundFloorCopy() {
return iInstant.withLocalMillis(iField.roundFloor(iInstant.getLocalMillis()));
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this date with the day of week 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 week changed.
*
* @param dayOfWeek the day of week to set
* @return a copy of this object with the field set
* @throws IllegalArgumentException if the value is invalid
*/
public LocalDate withDayOfWeek(int dayOfWeek) {
return withLocalMillis(getChronology().dayOfWeek().set(getLocalMillis(), dayOfWeek));
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Rounds to the nearest whole unit of this field on a copy of this
* LocalDate. If halfway, the ceiling is favored over the floor
* only if it makes this field's value even.
*
* @return a copy of the LocalDate with the field value changed
*/
public LocalDate roundHalfEvenCopy() {
return iInstant.withLocalMillis(iField.roundHalfEven(iInstant.getLocalMillis()));
}
}
内容来源于网络,如有侵权,请联系作者删除!