Package org.joda.time
Interface ReadWritableDateTime
-
- All Superinterfaces:
java.lang.Comparable<ReadableInstant>
,ReadableDateTime
,ReadableInstant
,ReadWritableInstant
- All Known Implementing Classes:
MutableDateTime
public interface ReadWritableDateTime extends ReadableDateTime, ReadWritableInstant
Defines an instant in time that can be queried and modified using datetime fields.The implementation of this interface will be mutable. It may provide more advanced methods than those in the interface.
Methods in your application should be defined using
ReadWritableDateTime
as a parameter if the method wants to manipulate and change a date in simple ways.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addDays(int days)
Add a number of days to the date.void
addHours(int hours)
Add a number of hours to the date.void
addMillis(int millis)
Add a number of milliseconds to the date.void
addMinutes(int minutes)
Add a number of minutes to the date.void
addMonths(int months)
Add a number of months to the date.void
addSeconds(int seconds)
Add a number of seconds to the date.void
addWeeks(int weeks)
Add a number of weeks to the date.void
addWeekyears(int weekyears)
Add a number of weekyears to the date.void
addYears(int years)
Add a number of years to the date.void
setDate(int year, int monthOfYear, int dayOfMonth)
Set the date from fields.void
setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Set the date and time from fields.void
setDayOfMonth(int dayOfMonth)
Set the day of the month to the specified value.void
setDayOfWeek(int dayOfWeek)
Set the day of week to the specified value.void
setDayOfYear(int dayOfYear)
Set the day of year to the specified value.void
setHourOfDay(int hourOfDay)
Set the hour of the day to the specified value.void
setMillisOfDay(int millisOfDay)
Set the millis of the day to the specified value.void
setMillisOfSecond(int millisOfSecond)
Set the millis of the second to the specified value.void
setMinuteOfDay(int minuteOfDay)
Set the minute of the day to the specified value.void
setMinuteOfHour(int minuteOfHour)
Set the minute of the hour to the specified value.void
setMonthOfYear(int monthOfYear)
Set the month of the year to the specified value.void
setSecondOfDay(int secondOfDay)
Set the second of the day to the specified value.void
setSecondOfMinute(int secondOfMinute)
Set the second of the minute to the specified value.void
setTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Set the time from fields.void
setWeekOfWeekyear(int weekOfWeekyear)
Set the week of weekyear to the specified value.void
setWeekyear(int weekyear)
Set the weekyear to the specified value.void
setYear(int year)
Set the year to the specified value.-
Methods inherited from interface org.joda.time.ReadableDateTime
getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toDateTime, toMutableDateTime, toString, toString
-
Methods inherited from interface org.joda.time.ReadableInstant
equals, get, getChronology, getMillis, getZone, hashCode, isAfter, isBefore, isEqual, isSupported, toInstant, toString
-
Methods inherited from interface org.joda.time.ReadWritableInstant
add, add, add, add, add, add, set, setChronology, setMillis, setMillis, setZone, setZoneRetainFields
-
-
-
-
Method Detail
-
setYear
void setYear(int year)
Set the year to the specified value.- Parameters:
year
- the year- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addYears
void addYears(int years)
Add a number of years to the date.- Parameters:
years
- the years to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setWeekyear
void setWeekyear(int weekyear)
Set the weekyear to the specified value.- Parameters:
weekyear
- the weekyear- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addWeekyears
void addWeekyears(int weekyears)
Add a number of weekyears to the date.- Parameters:
weekyears
- the weekyears to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setMonthOfYear
void setMonthOfYear(int monthOfYear)
Set the month of the year to the specified value.- Parameters:
monthOfYear
- the month of the year- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addMonths
void addMonths(int months)
Add a number of months to the date.- Parameters:
months
- the months to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setWeekOfWeekyear
void setWeekOfWeekyear(int weekOfWeekyear)
Set the week of weekyear to the specified value.- Parameters:
weekOfWeekyear
- the week of the weekyear- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addWeeks
void addWeeks(int weeks)
Add a number of weeks to the date.- Parameters:
weeks
- the weeks to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setDayOfYear
void setDayOfYear(int dayOfYear)
Set the day of year to the specified value.- Parameters:
dayOfYear
- the day of the year- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setDayOfMonth
void setDayOfMonth(int dayOfMonth)
Set the day of the month to the specified value.- Parameters:
dayOfMonth
- the day of the month- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setDayOfWeek
void setDayOfWeek(int dayOfWeek)
Set the day of week to the specified value.- Parameters:
dayOfWeek
- the day of the week- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addDays
void addDays(int days)
Add a number of days to the date.- Parameters:
days
- the days to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setHourOfDay
void setHourOfDay(int hourOfDay)
Set the hour of the day to the specified value.- Parameters:
hourOfDay
- the hour of day- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addHours
void addHours(int hours)
Add a number of hours to the date.- Parameters:
hours
- the hours to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setMinuteOfDay
void setMinuteOfDay(int minuteOfDay)
Set the minute of the day to the specified value.- Parameters:
minuteOfDay
- the minute of day- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setMinuteOfHour
void setMinuteOfHour(int minuteOfHour)
Set the minute of the hour to the specified value.- Parameters:
minuteOfHour
- the minute of hour- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addMinutes
void addMinutes(int minutes)
Add a number of minutes to the date.- Parameters:
minutes
- the minutes to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setSecondOfDay
void setSecondOfDay(int secondOfDay)
Set the second of the day to the specified value.- Parameters:
secondOfDay
- the second of day- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setSecondOfMinute
void setSecondOfMinute(int secondOfMinute)
Set the second of the minute to the specified value.- Parameters:
secondOfMinute
- the second of minute- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addSeconds
void addSeconds(int seconds)
Add a number of seconds to the date.- Parameters:
seconds
- the seconds to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setMillisOfDay
void setMillisOfDay(int millisOfDay)
Set the millis of the day to the specified value.- Parameters:
millisOfDay
- the millis of day- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setMillisOfSecond
void setMillisOfSecond(int millisOfSecond)
Set the millis of the second to the specified value.- Parameters:
millisOfSecond
- the millis of second- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
addMillis
void addMillis(int millis)
Add a number of milliseconds to the date. The implementation of this method differs from theReadWritableInstant.add(long)
method in that a DateTimeField performs the addition.- Parameters:
millis
- the milliseconds to add- Throws:
java.lang.IllegalArgumentException
- if the value is invalid
-
setDate
void setDate(int year, int monthOfYear, int dayOfMonth)
Set the date from fields. The time part of this object will be unaffected.- Parameters:
year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the month- Throws:
java.lang.IllegalArgumentException
- if any value is invalid
-
setTime
void setTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Set the time from fields. The date part of this object will be unaffected.- Parameters:
hour
- the hourminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the second- Throws:
java.lang.IllegalArgumentException
- if any value is invalid
-
setDateTime
void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Set the date and time from fields.- Parameters:
year
- the yearmonthOfYear
- the month of the yeardayOfMonth
- the day of the monthhourOfDay
- the hour of the dayminuteOfHour
- the minute of the hoursecondOfMinute
- the second of the minutemillisOfSecond
- the millisecond of the second- Throws:
java.lang.IllegalArgumentException
- if any value is invalid
-
-