public final class DateTime
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MILLISECONDS_PER_DAY |
static int |
MILLISECONDS_PER_HOUR |
static int |
MILLISECONDS_PER_MINUTE |
static int |
MILLISECONDS_PER_SECOND |
static long |
NULL_DATE |
Constructor and Description |
---|
DateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour)
Constructs an instance from datetime field values using
ISOChronology in the default time zone. |
DateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute)
Constructs an instance from datetime field values using
ISOChronology in the default time zone. |
DateTime(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. |
DateTime(long millis)
Constructs an instance set to the milliseconds from 1970-01-01T00:00:00Z using
ISOChronology in the
default time zone. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
int |
getDayOfMonth()
Get the day of month field value.
|
int |
getDayOfWeek()
Get the day of week.
|
int |
getDayOfYear()
Get the day of year field value.
|
int |
getHourOfDay()
Get the hour of day field value.
|
int |
getMillisOfSecond()
Get the millis of second field value.
|
int |
getMinuteOfHour()
Get the minute of hour field value.
|
int |
getMonthOfYear()
Get the month of year field value.
|
int |
getSecondOfMinute()
Get the second of minute field value.
|
int |
getYear() |
int |
hashCode() |
static boolean |
isLeapYear(int year) |
static DateTime |
now()
Obtains a
DateTime set to the current system millisecond time using ISOChronology in the
default time zone. |
static DateTime |
parseRFC3339(java.lang.String rfc3339DateTime) |
DateTime |
plusHours(long hours) |
DateTime |
plusMillis(long millis)
Returns a copy of this datetime plus the specified number of millis.
|
DateTime |
plusMinutes(long minutes) |
DateTime |
plusSeconds(long seconds) |
static long |
rfc3339ToMillis(java.lang.String rfc3339DateTime)
Given the RFC3339 date/time string, return the time in millis (milliseconds since Jan 1, 1970, UTC).
|
long |
toMillis() |
java.lang.String |
toRFC3339String() |
java.lang.String |
toString() |
public static final int MILLISECONDS_PER_SECOND
public static final int MILLISECONDS_PER_MINUTE
public static final int MILLISECONDS_PER_HOUR
public static final int MILLISECONDS_PER_DAY
public static final long NULL_DATE
public DateTime(long millis)
ISOChronology
in the
default time zone.millis
- the milliseconds from 1970-01-01T00:00:00Zpublic DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour)
ISOChronology
in the default time zone.year
- the yearmonthOfYear
- the month of the year, from 1 to 12dayOfMonth
- the day of the month, from 1 to 31hourOfDay
- the hour of the day, from 0 to 23minuteOfHour
- the minute of the hour, from 0 to 59public DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute)
ISOChronology
in the default time zone.year
- the yearmonthOfYear
- the month of the year, from 1 to 12dayOfMonth
- the day of the month, from 1 to 31hourOfDay
- the hour of the day, from 0 to 23minuteOfHour
- the minute of the hour, from 0 to 59secondOfMinute
- the second of the minute, from 0 to 59public DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
ISOChronology
in the default time zone.year
- the yearmonthOfYear
- the month of the year, from 1 to 12dayOfMonth
- the day of the month, from 1 to 31hourOfDay
- the hour of the day, from 0 to 23minuteOfHour
- the minute of the hour, from 0 to 59secondOfMinute
- the second of the minute, from 0 to 59millisOfSecond
- the millisecond of the second, from 0 to 999public static DateTime now()
DateTime
set to the current system millisecond time using ISOChronology
in the
default time zone.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static boolean isLeapYear(int year)
public long toMillis()
public int getYear()
public int getMonthOfYear()
public int getDayOfYear()
public int getDayOfMonth()
public int getDayOfWeek()
public int getHourOfDay()
public int getMinuteOfHour()
public int getSecondOfMinute()
public int getMillisOfSecond()
public DateTime plusMillis(long millis)
millis
- the amount of millis to add, may be negativepublic DateTime plusSeconds(long seconds)
public DateTime plusMinutes(long minutes)
public DateTime plusHours(long hours)
public static long rfc3339ToMillis(java.lang.String rfc3339DateTime)
rfc3339DateTime
- date/time string, in RFC3339 formatpublic static DateTime parseRFC3339(java.lang.String rfc3339DateTime)
public java.lang.String toRFC3339String()