Joda Time API

org.joda.time
Class MutableDateTime

java.lang.Object
  |
  +--org.joda.time.AbstractInstant
        |
        +--org.joda.time.AbstractDateTime
              |
              +--org.joda.time.MutableDateTime
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, ReadableDateTime, ReadableInstant, ReadWritableInstant, java.io.Serializable

public class MutableDateTime
extends AbstractDateTime
implements ReadableDateTime, ReadWritableInstant, java.lang.Cloneable

MutableDateTime is the standard implementation of a modifiable datetime class. It holds the date/time as milliseconds from the Java epoch of 1970-01-01T00:00:00Z.

This class requires a Chronology to be specified. The Chronology determines how the millisecond instant value is converted into the date time fields.

Each individual field can be accessed in two ways:

The second technique also provides access to other useful methods on the field:

Since:
1.0
Author:
Guy Allard, Brian S O'Neill, Stephen Colebourne
See Also:
Serialized Form

Constructor Summary
MutableDateTime()
          Constructs a MutableDateTime to the current datetime, as reported by the system clock.
MutableDateTime(java.util.Calendar calendar)
          Constructs a MutableDateTime from a Calendar, using its closest mapped chronology and time zone.
MutableDateTime(java.util.Calendar calendar, Chronology chronology)
          Constructs a MutableDateTime from a Calendar, using the supplied chronology.
MutableDateTime(java.util.Calendar calendar, DateTimeZone zone)
          Constructs a MutableDateTime from a Calendar, using its closest mapped chronology against a different time zone.
MutableDateTime(Chronology chronology)
          Constructs a MutableDateTime to the current datetime, as reported by the system clock.
MutableDateTime(java.util.Date date)
          Constructs a MutableDateTime from a Date, using the ISO chronology, in the default time zone.
MutableDateTime(java.util.Date date, Chronology chronology)
          Constructs a MutableDateTime from a Date, using the supplied chronology.
MutableDateTime(java.util.Date date, DateTimeZone zone)
          Constructs a MutableDateTime from a Date, using the ISO chronology, in the supplied time zone.
MutableDateTime(DateTimeZone zone)
          Constructs a MutableDateTime to the current datetime, as reported by the system clock.
MutableDateTime(long millis)
          Constructs a MutableDateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the ISO chronology, in the default time zone.
MutableDateTime(long millis, Chronology chronology)
          Constructs a MutableDateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the supplied chronology.
MutableDateTime(long millis, DateTimeZone zone)
          Constructs a MutableDateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the ISO chronology, in the supplied time zone.
MutableDateTime(ReadableInstant instant)
          Constructs a MutableDateTime from a ReadableInstant, using its chronology.
MutableDateTime(ReadableInstant instant, Chronology chronology)
          Constructs a MutableDateTime from a ReadableInstant, using the supplied chronology.
MutableDateTime(ReadableInstant instant, DateTimeZone zone)
          Constructs a MutableDateTime from a ReadableInstant, using its chronology against a different time zone.
MutableDateTime(java.lang.String str)
          Constructs a MutableDateTime from an ISO formatted String, using the ISO chronology, in the default time zone.
MutableDateTime(java.lang.String str, Chronology chronology)
          Constructs a MutableDateTime from an ISO formatted String, using the supplied chronology.
MutableDateTime(java.lang.String str, DateTimeZone zone)
          Constructs a MutableDateTime from an ISO formatted String, using the ISO chronology, in the supplied time zone.
 
Method Summary
 void add(DateTimeField field, int value)
          Add a value to the specified field.
 void add(java.lang.Object object)
          Add an amount of time to the date.
 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(long millis)
          Add an amount of time to the datetime.
 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 addWrapped(DateTimeField field, int value)
          Add a value to the specified field, wrapping within that field.
 void addYears(int years)
          Add a number of years to the date.
 MutableDateTimeFieldProperty centuryOfEra()
          Get the century of era property.
 java.lang.Object clone()
          Clone this object.
 MutableDateTime copy()
          Clone this object without having to cast the returned object.
protected  ReadableInstant create(long millis, Chronology chrono)
          Creates a new instance of this class.
 MutableDateTimeFieldProperty dayOfMonth()
          Get the day of month property.
 MutableDateTimeFieldProperty dayOfWeek()
          Get the day of week property.
 MutableDateTimeFieldProperty dayOfYear()
          Get the day of year property.
 MutableDateTimeFieldProperty era()
          Get the era property.
 Chronology getChronology()
          Gets the chronology of the datetime.
protected  long getDateTimeMillisFromObject(java.lang.Object object)
          Extracts a long datetime value from an object.
protected  long getDurationMillisFromObject(java.lang.Object object)
          Extracts a fixed millisecond duration from an object.
 long getMillis()
          Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z.
 MutableDateTimeFieldProperty hourOfDay()
          Get the hour of day field property
 MutableDateTimeFieldProperty millisOfDay()
          Get the millis of day property
 MutableDateTimeFieldProperty millisOfSecond()
          Get the millis of second property
 MutableDateTimeFieldProperty minuteOfDay()
          Get the minute of day property
 MutableDateTimeFieldProperty minuteOfHour()
          Get the minute of hour field property
 MutableDateTimeFieldProperty monthOfYear()
          Get the month of year property.
 MutableDateTimeFieldProperty secondOfDay()
          Get the second of day property
 MutableDateTimeFieldProperty secondOfMinute()
          Get the second of minute field property
 void set(DateTimeField field, int value)
          Set a value in the specified field.
 void setChronology(Chronology chronology)
          Set the chronology of the datetime.
 void setDate(int year, int monthOfYear, int dayOfMonth)
          Set the date from fields.
 void setDate(long millis)
          Set the date from milliseconds.
 void setDate(java.lang.Object date)
          Set the date from various different types of object.
 void setDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
          Set the date and time from fields.
 void setDateTime(long millis)
          Set the date and time from milliseconds.
 void setDateTime(java.lang.Object datetime)
          Set the date and time from an object.
 void setDateTimeZone(DateTimeZone zone)
          Sets the time zone of the datetime via the chronology.
 void setDayOfMonth(int dayOfMonth)
          Set the day of the month to a value.
 void setDayOfWeek(int dayOfWeek)
          Set the day of week to a value.
 void setDayOfYear(int dayOfYear)
          Set the day of year to a value.
 void setHourOfDay(int hour)
          Set the hour of the day.
 void setMillis(long millis)
          Set the milliseconds of the datetime.
 void setMillis(java.lang.Object object)
          Set the number of milliseconds of the datetime.
 void setMillisOfDay(int millis)
          Set the millis of the day.
 void setMillisOfSecond(int millis)
          Set the millis of the second.
 void setMinuteOfDay(int minute)
          Set the minute of the day.
 void setMinuteOfHour(int minute)
          Set the minute of the hour.
 void setMonthOfYear(int month)
          Set the month of the year to a value.
 void setSecondOfDay(int second)
          Set the second of the day.
 void setSecondOfMinute(int second)
          Set the second of the minute.
 void setTime(int hour, int minuteOfHour, int secondOfMinute, int millisOfSecond)
          Set the time from fields.
 void setTime(long millis)
          Set the time from milliseconds.
 void setTime(java.lang.Object time)
          Set the time from an object.
 void setWeekOfWeekyear(int weekOfWeekyear)
          Set the week of weekyear to a value.
 void setWeekyear(int weekyear)
          Set the week of the year to a value.
 void setYear(int year)
          Set the year to a value.
 java.lang.String toString()
          Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ).
 MutableDateTimeFieldProperty weekOfWeekyear()
          Get the week of a week based year property.
 MutableDateTimeFieldProperty weekyear()
          Get the year of a week based year property.
 MutableDateTimeFieldProperty year()
          Get the year property.
 MutableDateTimeFieldProperty yearOfCentury()
          Get the year of century property.
 MutableDateTimeFieldProperty yearOfEra()
          Get the year of era property.
 
Methods inherited from class org.joda.time.AbstractDateTime
getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toDateTime, toDateTime, toDateTime, toISODateTime, toISODateTime, toISOMutableDateTime, toISOMutableDateTime, toMutableDateTime, toMutableDateTime, toMutableDateTime, toString, toString
 
Methods inherited from class org.joda.time.AbstractInstant
compareTo, equals, get, getDateTimeZone, hashCode, isAfter, isBefore, isEqual, toCalendar, toCopy, toCopy, toDate, toGregorianCalendar, toInstant
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
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, toDateTime, toDateTime, toMutableDateTime, toMutableDateTime, toMutableDateTime, toString, toString
 
Methods inherited from interface org.joda.time.ReadableInstant
compareTo, equals, get, getDateTimeZone, hashCode, isAfter, isBefore, isEqual, toCopy, toCopy, toInstant
 

Constructor Detail

MutableDateTime

public MutableDateTime()
Constructs a MutableDateTime to the current datetime, as reported by the system clock. The chronology used is ISO, in the default time zone.


MutableDateTime

public MutableDateTime(DateTimeZone zone)
Constructs a MutableDateTime to the current datetime, as reported by the system clock. The chronology used is ISO, in the supplied time zone.

Parameters:
zone - the time zone, must not be null
Throws:
java.lang.IllegalArgumentException - if the zone is null

MutableDateTime

public MutableDateTime(Chronology chronology)
Constructs a MutableDateTime to the current datetime, as reported by the system clock.

Parameters:
chronology - the chronology, must not be null
Throws:
java.lang.IllegalArgumentException - if the chronology is null

MutableDateTime

public MutableDateTime(long millis)
Constructs a MutableDateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the ISO chronology, in the default time zone.

Parameters:
millis - the milliseconds

MutableDateTime

public MutableDateTime(long millis,
                       DateTimeZone zone)
Constructs a MutableDateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the ISO chronology, in the supplied time zone.

Parameters:
millis - the milliseconds
zone - the time zone, must not be null
Throws:
java.lang.IllegalArgumentException - if the zone is null

MutableDateTime

public MutableDateTime(long millis,
                       Chronology chronology)
Constructs a MutableDateTime set to the milliseconds from 1970-01-01T00:00:00Z, using the supplied chronology.

Parameters:
millis - the milliseconds
chronology - the chronology, must not be null
Throws:
java.lang.IllegalArgumentException - if the chronology is null

MutableDateTime

public MutableDateTime(ReadableInstant instant)
Constructs a MutableDateTime from a ReadableInstant, using its chronology. If its chronology null, then the chronology is set to ISO, in the default time zone.

Parameters:
instant - the ReadableInstant, must not be null
Throws:
java.lang.IllegalArgumentException - if the instant is null

MutableDateTime

public MutableDateTime(ReadableInstant instant,
                       DateTimeZone zone)
Constructs a MutableDateTime from a ReadableInstant, using its chronology against a different time zone. If its chronology is null, then the chronology is set to ISO. If the selected chronology is not in the supplied time zone, a new chronology is created that is.

Parameters:
instant - the ReadableInstant, must not be null
zone - the time zone, must not be null
Throws:
java.lang.IllegalArgumentException - if the instant or zone is null

MutableDateTime

public MutableDateTime(ReadableInstant instant,
                       Chronology chronology)
Constructs a MutableDateTime from a ReadableInstant, using the supplied chronology.

Parameters:
instant - the ReadableInstant, must not be null
chronology - the chronology, must not be null
Throws:
java.lang.IllegalArgumentException - if the instant or chronology is null

MutableDateTime

public MutableDateTime(java.util.Date date)
Constructs a MutableDateTime from a Date, using the ISO chronology, in the default time zone.

Parameters:
date - the Date, must not be null
Throws:
java.lang.IllegalArgumentException - if the date is null

MutableDateTime

public MutableDateTime(java.util.Date date,
                       DateTimeZone zone)
Constructs a MutableDateTime from a Date, using the ISO chronology, in the supplied time zone.

Parameters:
date - the Date, must not be null
zone - the time zone, must not be null
Throws:
java.lang.IllegalArgumentException - if the date or zone is null

MutableDateTime

public MutableDateTime(java.util.Date date,
                       Chronology chronology)
Constructs a MutableDateTime from a Date, using the supplied chronology.

Parameters:
date - the Date, must not be null
chronology - the chronology, must not be null
Throws:
java.lang.IllegalArgumentException - if the date or chronology is null

MutableDateTime

public MutableDateTime(java.util.Calendar calendar)
Constructs a MutableDateTime from a Calendar, using its closest mapped chronology and time zone.

When converting calendars to chronologies, the constructor is aware of GregorianCalendar and BuddhistCalendar and maps them to the equivalent chronology. Other calendars map to ISOChronology.

Parameters:
calendar - the Calendar, must not be null
Throws:
java.lang.IllegalArgumentException - if the calendar is null

MutableDateTime

public MutableDateTime(java.util.Calendar calendar,
                       DateTimeZone zone)
Constructs a MutableDateTime from a Calendar, using its closest mapped chronology against a different time zone.

When converting calendars to chronologies, the constructor is aware of GregorianCalendar and BuddhistCalendar and maps them to the equivalent chronology. Other calendars map to ISOChronology.

Parameters:
calendar - the Calendar, must not be null
Throws:
java.lang.IllegalArgumentException - if the calendar or zone is null

MutableDateTime

public MutableDateTime(java.util.Calendar calendar,
                       Chronology chronology)
Constructs a MutableDateTime from a Calendar, using the supplied chronology.

Parameters:
calendar - the Calendar, must not be null
chronology - the chronology, must not be null
Throws:
java.lang.IllegalArgumentException - if the calendar or chronology is null

MutableDateTime

public MutableDateTime(java.lang.String str)
                throws java.text.ParseException
Constructs a MutableDateTime from an ISO formatted String, using the ISO chronology, in the default time zone.

Parameters:
str - the string to parse, must not be null
Throws:
java.lang.IllegalArgumentException - if the string is null
java.text.ParseException - if parsing fails

MutableDateTime

public MutableDateTime(java.lang.String str,
                       DateTimeZone zone)
                throws java.text.ParseException
Constructs a MutableDateTime from an ISO formatted String, using the ISO chronology, in the supplied time zone.

Parameters:
str - the string to parse, must not be null
zone - the time zone, must not be null
Throws:
java.lang.IllegalArgumentException - if the string or zone is null
java.text.ParseException - if parsing fails

MutableDateTime

public MutableDateTime(java.lang.String str,
                       Chronology chronology)
                throws java.text.ParseException
Constructs a MutableDateTime from an ISO formatted String, using the supplied chronology.

Parameters:
str - the string to parse, must not be null
chronology - the chronology, must not be null
Throws:
java.lang.IllegalArgumentException - if the string or chronology is null
java.text.ParseException - if parsing fails
Method Detail

create

protected ReadableInstant create(long millis,
                                 Chronology chrono)
Creates a new instance of this class.

The returned object will be a new instance of the implementation. Immutable subclasses may return this if appropriate.

Specified by:
create in class AbstractInstant
Parameters:
millis - the new millis, from 1970-01-01T00:00:00Z
chrono - the new chronology
Returns:
a new instance of this class
Throws:
java.lang.IllegalArgumentException - if the chronology is null

getMillis

public long getMillis()
Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z.

Specified by:
getMillis in interface ReadableInstant
Returns:
the number of milliseconds since 1970-01-01T00:00:00Z

setMillis

public void setMillis(long millis)
Set the milliseconds of the datetime.

Specified by:
setMillis in interface ReadWritableInstant
Parameters:
millis - the milliseconds since 1970-01-01T00:00:00Z to set the datetime to
Returns:
the value as milliseconds

setMillis

public void setMillis(java.lang.Object object)
Set the number of milliseconds of the datetime.

Specified by:
setMillis in interface ReadWritableInstant
Returns:
the value as a Calendar
Throws:
java.lang.IllegalArgumentException - if the object is null
java.lang.ClassCastException - if the object's type cannot be recognised

add

public void add(java.lang.Object object)
Add an amount of time to the date.

Specified by:
add in interface ReadWritableInstant
Parameters:
object - a ReadableDuration, Long or String evaluating to a duration

addMillis

public void addMillis(long millis)
Add an amount of time to the datetime.

Specified by:
addMillis in interface ReadWritableInstant
Parameters:
millis - the millis to add

getChronology

public Chronology getChronology()
Gets the chronology of the datetime.

Specified by:
getChronology in interface ReadableInstant
Returns:
the Chronology that the datetime is using

setChronology

public void setChronology(Chronology chronology)
Set the chronology of the datetime.

Parameters:
chronology - the chronology to use
Throws:
java.lang.IllegalArgumentException - if the chronology is null

setDateTimeZone

public void setDateTimeZone(DateTimeZone zone)
Sets the time zone of the datetime via the chronology.

Parameters:
zone - the time zone to use
Throws:
java.lang.IllegalArgumentException - if the time zone is null

set

public void set(DateTimeField field,
                int value)
Set a value in the specified field. This could be used to set a field using a different Chronology. For example:
 MutableDateTime dt = new MutableDateTime();
 dt.set(GJChronology.getInstance().year(), 2002);
 

Specified by:
set in interface ReadWritableInstant
Parameters:
field - the DateTimeField to use
value - the value
Throws:
java.lang.NullPointerException - if the field is null

add

public void add(DateTimeField field,
                int value)
Add a value to the specified field. This could be used to set a field using a different Chronology. For example:
 MutableDateTime dt = new MutableDateTime();
 dt.add(GJChronology.getInstance().year(), 2);
 

Specified by:
add in interface ReadWritableInstant
Parameters:
field - the DateTimeField to use
value - the value
Throws:
java.lang.NullPointerException - if the field is null

addWrapped

public void addWrapped(DateTimeField field,
                       int value)
Add a value to the specified field, wrapping within that field. This could be used to set a field using a different Chronology. For example:
 MutableDateTime dt = new MutableDateTime();
 dt.addWrapped(GJChronology.getInstance().monthOfYear(), 6);
 

Specified by:
addWrapped in interface ReadWritableInstant
Parameters:
field - the DateTimeField to use
value - the value
Throws:
java.lang.NullPointerException - if the field is null

setDayOfWeek

public void setDayOfWeek(int dayOfWeek)
Set the day of week to a value.

Parameters:
dayOfWeek - the day of the week.

setDayOfMonth

public void setDayOfMonth(int dayOfMonth)
Set the day of the month to a value.

Parameters:
dayOfMonth - the day of the month.

setDayOfYear

public void setDayOfYear(int dayOfYear)
Set the day of year to a value.

Parameters:
dayOfYear - the day of the year.

addDays

public void addDays(int days)
Add a number of days to the date.

Parameters:
days - the days to add.

setWeekOfWeekyear

public void setWeekOfWeekyear(int weekOfWeekyear)
Set the week of weekyear to a value.

Parameters:
weekOfWeekyear - the week of the weekyear.

addWeeks

public void addWeeks(int weeks)
Add a number of weeks to the date.

Parameters:
weeks - the weeks to add.

setWeekyear

public void setWeekyear(int weekyear)
Set the week of the year to a value.

Parameters:
weekyear - the weekyear.

addWeekyears

public void addWeekyears(int weekyears)
Add a number of weekyears to the date.

Parameters:
weekyears - the weekyears to add.

setMonthOfYear

public void setMonthOfYear(int month)
Set the month of the year to a value.

Parameters:
month - the month of the year.

addMonths

public void addMonths(int months)
Add a number of months to the date.

Parameters:
months - the months to add.

setYear

public void setYear(int year)
Set the year to a value.

Parameters:
year - the year.

addYears

public void addYears(int years)
Add a number of years to the date.

Parameters:
years - the years to add.

setMillisOfSecond

public void setMillisOfSecond(int millis)
Set the millis of the second.

Parameters:
millis - the millis of second.

setMillisOfDay

public void setMillisOfDay(int millis)
Set the millis of the day.

Parameters:
millis - the millis of day.

setSecondOfMinute

public void setSecondOfMinute(int second)
Set the second of the minute.

Parameters:
second - the second of minute.

setSecondOfDay

public void setSecondOfDay(int second)
Set the second of the day.

Parameters:
second - the second of day.

addSeconds

public void addSeconds(int seconds)
Add a number of seconds to the date.

Parameters:
seconds - the seconds to add.

setMinuteOfHour

public void setMinuteOfHour(int minute)
Set the minute of the hour.

Parameters:
minute - the minute of hour.

setMinuteOfDay

public void setMinuteOfDay(int minute)
Set the minute of the day.

Parameters:
minute - the minute of day.

addMinutes

public void addMinutes(int minutes)
Add a number of minutes to the date.

Parameters:
minutes - the minutes to add.

setHourOfDay

public void setHourOfDay(int hour)
Set the hour of the day.

Parameters:
hour - the hour of day.

addHours

public void addHours(int hours)
Add a number of hours to the date.

Parameters:
hours - the hours to add.

setDate

public void setDate(java.lang.Object date)
Set the date from various different types of object. The time part of the parameter will be ignored. The time part of this object will be unaffected.

Parameters:
date - a ReadableInstant, Date, Calendar, Long or String
Throws:
java.lang.IllegalArgumentException - if the object is null.
java.lang.ClassCastException - if the object's type cannot be recognised

setDate

public void setDate(long millis)
Set the date from milliseconds. The time part of the parameter will be ignored. The time part of this object will be unaffected.

Parameters:
millis - milliseconds from 1970-01-01T00:00:00Z, ignoring time of day

setDate

public 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 year
dayOfMonth - the day of the month

setTime

public void setTime(java.lang.Object time)
Set the time from an object. The date part of the parameter will be ignored. The date part of this object will be unaffected.

Parameters:
time - a ReadableInstant, Date, Calendar, Long or String
Throws:
java.lang.IllegalArgumentException - if the object is null.
java.lang.ClassCastException - if the object's type cannot be recognised

setTime

public void setTime(long millis)
Set the time from milliseconds. The date part of the parameter will be ignored. The date part of this object will be unaffected.

Parameters:
millis - milliseconds from T00:00:00Z, ignoring date

setTime

public 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 hour
minuteOfHour - the minute of the hour
secondOfMinute - the second of the minute
millisOfSecond - the milisecond of the second

setDateTime

public void setDateTime(java.lang.Object datetime)
Set the date and time from an object.

Parameters:
datetime - a ReadableInstant, Date, Calendar, Long or String
Throws:
java.lang.IllegalArgumentException - if the object is null.
java.lang.ClassCastException - if the object's type cannot be recognised

setDateTime

public void setDateTime(long millis)
Set the date and time from milliseconds.

Parameters:
millis - the millis

setDateTime

public 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 year
dayOfMonth - the day of the month
minuteOfHour - the minute of the hour
secondOfMinute - the second of the minute
millisOfSecond - the milisecond of the second

dayOfWeek

public MutableDateTimeFieldProperty dayOfWeek()
Get the day of week property.

The values for day of week are defined in DateTimeConstants.

Returns:
the day of week property

dayOfMonth

public MutableDateTimeFieldProperty dayOfMonth()
Get the day of month property.

Returns:
the day of month property

dayOfYear

public MutableDateTimeFieldProperty dayOfYear()
Get the day of year property.

Returns:
the day of year property

weekOfWeekyear

public MutableDateTimeFieldProperty weekOfWeekyear()
Get the week of a week based year property.

Returns:
the week of a week based year property

weekyear

public MutableDateTimeFieldProperty weekyear()
Get the year of a week based year property.

Returns:
the year of a week based year property

monthOfYear

public MutableDateTimeFieldProperty monthOfYear()
Get the month of year property.

Returns:
the month of year property

year

public MutableDateTimeFieldProperty year()
Get the year property.

Returns:
the year property

yearOfEra

public MutableDateTimeFieldProperty yearOfEra()
Get the year of era property.

Returns:
the year of era property

yearOfCentury

public MutableDateTimeFieldProperty yearOfCentury()
Get the year of century property.

Returns:
the year of era property

centuryOfEra

public MutableDateTimeFieldProperty centuryOfEra()
Get the century of era property.

Returns:
the year of era property

era

public MutableDateTimeFieldProperty era()
Get the era property.

Returns:
the era property

millisOfSecond

public MutableDateTimeFieldProperty millisOfSecond()
Get the millis of second property

Returns:
the millis of second property

millisOfDay

public MutableDateTimeFieldProperty millisOfDay()
Get the millis of day property

Returns:
the millis of day property

secondOfMinute

public MutableDateTimeFieldProperty secondOfMinute()
Get the second of minute field property

Returns:
the second of minute property

secondOfDay

public MutableDateTimeFieldProperty secondOfDay()
Get the second of day property

Returns:
the second of day property

minuteOfHour

public MutableDateTimeFieldProperty minuteOfHour()
Get the minute of hour field property

Returns:
the minute of hour property

minuteOfDay

public MutableDateTimeFieldProperty minuteOfDay()
Get the minute of day property

Returns:
the minute of day property

hourOfDay

public MutableDateTimeFieldProperty hourOfDay()
Get the hour of day field property

Returns:
the hour of day property

toString

public java.lang.String toString()
Output the date time in ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSZ).

Specified by:
toString in interface ReadableInstant
Overrides:
toString in class AbstractDateTime
Returns:
ISO8601 time formatted string.

copy

public MutableDateTime copy()
Clone this object without having to cast the returned object.

Returns:
a clone of the this object.

clone

public java.lang.Object clone()
Clone this object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this object.

getDateTimeMillisFromObject

protected long getDateTimeMillisFromObject(java.lang.Object object)
Extracts a long datetime value from an object.

Parameters:
object - an input object
Returns:
a long date-time value
Throws:
java.lang.IllegalArgumentException - if the object is null, or the string invalid
java.lang.ClassCastException - if the object type is not supported

getDurationMillisFromObject

protected long getDurationMillisFromObject(java.lang.Object object)
Extracts a fixed millisecond duration from an object.

Parameters:
object - Long or String
Throws:
java.lang.IllegalArgumentException - if the object is null, or the string invalid
java.lang.ClassCastException - if the object type is not supported

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.