public abstract class BaseDateTime extends AbstractDateTimeimplements Serializable
long and
Chronology fields.
This class should generally not be used directly by API users. The
ReadableDateTime interface should be used when different kinds of date/time objects are to be referenced.
BaseDateTime subclasses may be mutable and not thread-safe.
| Constructor and Description |
|---|
BaseDateTime()
Constructs an instance set to the current system millisecond time using
ISOChronology in the default time zone.
|
BaseDateTime(Chronology chronology)
Constructs an instance set to the current system millisecond time using the specified chronology.
|
BaseDateTime(DateTimeZone zone)
Constructs an instance set to the current system millisecond time using
ISOChronology in the specified time zone.
|
BaseDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Constructs an instance from datetime field values using
ISOChronology in the default time zone.
|
BaseDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, Chronology chronology)
Constructs an instance from datetime field values using the specified chronology.
|
BaseDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond, DateTimeZone zone)
Constructs an instance from datetime field values using
ISOChronology in the specified time zone.
|
BaseDateTime(long instant, Chronology chronology)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using the specified chronology.
|
BaseDateTime(long instant, DateTimeZone zone)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using
ISOChronology in the specified time zone.
|
BaseDateTime(Object
Constructs an instance from an Object that represents a datetime, using the specified chronology.
|
BaseDateTime(Object
Constructs an instance from an Object that represents a datetime, forcing the time zone to that specified.
|
| Modifier and Type | Method and Description |
|---|---|
protected Chronology |
checkChronology(Chronology chronology)
Checks the specified chronology before storing it, potentially altering it.
|
protected long |
checkInstant(long instant, Chronology chronology)
Checks the specified instant before storing it, potentially altering it.
|
Chronology |
getChronology()
Gets the chronology of the datetime.
|
long |
getMillis()
Gets the milliseconds of the datetime instant from the Java epoch of 1970-01-01T00:00:00Z.
|
protected void |
setChronology(Chronology chronology)
Sets the chronology of the datetime.
|
protected void |
setMillis(long instant)
Sets the milliseconds of the datetime.
|
public BaseDateTime()
ISOChronology in the default time zone.
public BaseDateTime(DateTimeZone zone)
ISOChronology in the specified time zone.
If the specified time zone is null, the default zone is used.
zone - the time zone, null means default zone
public BaseDateTime(Chronology chronology)
ISOChronology in the default time zone is used.
chronology - the chronology, null means ISOChronology in default zone
public BaseDateTime(long instant,
DateTimeZone zone)
ISOChronology in the specified time zone.
If the specified time zone is null, the default zone is used.
instant - the milliseconds from 1970-01-01T00:00:00Z
zone - the time zone, null means default zone
public BaseDateTime(long instant,
Chronology chronology)
ISOChronology in the default time zone is used.
instant - the milliseconds from 1970-01-01T00:00:00Z
chronology - the chronology, null means ISOChronology in default zone
public BaseDateTime(Objectinstant, DateTimeZone zone)
ISOChronology is used. If the specified time zone is null, the default zone is used.
The recognised object types are defined in
ConverterManager and include ReadableInstant, String, Calendar and Date.
instant - the datetime object
zone - the time zone
IllegalArgumentException - if the instant is invalid
public BaseDateTime(Objectinstant, Chronology chronology)
ConverterManager and include ReadableInstant, String, Calendar and Date.
instant - the datetime object
chronology - the chronology
IllegalArgumentException - if the instant is invalid
public BaseDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
ISOChronology in the default time zone.
year - the year
monthOfYear - the month of the year
dayOfMonth - the day of the month
hourOfDay - the hour of the day
minuteOfHour - the minute of the hour
secondOfMinute - the second of the minute
millisOfSecond - the millisecond of the second
public BaseDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond,
DateTimeZone zone)
ISOChronology in the specified time zone.
If the specified time zone is null, the default zone is used.
year - the year
monthOfYear - the month of the year
dayOfMonth - the day of the month
hourOfDay - the hour of the day
minuteOfHour - the minute of the hour
secondOfMinute - the second of the minute
millisOfSecond - the millisecond of the second
zone - the time zone, null means default time zone
public BaseDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond,
Chronology chronology)
ISOChronology in the default time zone is used.
year - the year
monthOfYear - the month of the year
dayOfMonth - the day of the month
hourOfDay - the hour of the day
minuteOfHour - the minute of the hour
secondOfMinute - the second of the minute
millisOfSecond - the millisecond of the second
chronology - the chronology, null means ISOChronology in default zone
protected Chronology checkChronology(Chronology chronology)
chronology - the chronology to use, may be null
protected long checkInstant(long instant,
Chronology chronology)
instant - the milliseconds from 1970-01-01T00:00:00Z to round
chronology - the chronology to use, not null
public long getMillis()
public Chronology getChronology()
protected void setMillis(long instant)
instant - the milliseconds since 1970-01-01T00:00:00Z to set the datetime to
protected void setChronology(Chronology chronology)
chronology - the chronology to set