|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.util.DateTime
public final class DateTime
Immutable representation of a date with an optional time and an optional time zone based on RFC 3339.
Implementation is immutable and therefore thread-safe.
Constructor Summary | |
---|---|
DateTime(boolean dateOnly,
long value,
Integer tzShift)
|
|
DateTime(Date value)
|
|
DateTime(Date date,
TimeZone zone)
|
|
DateTime(long value)
|
|
DateTime(long value,
Integer tzShift)
|
|
DateTime(String value)
Instantiates DateTime from an RFC 3339
date/time value. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
Integer |
getTimeZoneShift()
Returns the time zone shift from UTC in minutes or null for local time zone. |
long |
getValue()
Returns the date/time value expressed as the number of milliseconds since the Unix epoch. |
boolean |
isDateOnly()
Returns whether this is a date-only value. |
static DateTime |
parseRfc3339(String str)
Parses an RFC 3339 date/time value. |
String |
toString()
|
String |
toStringRfc3339()
Formats the value as an RFC 3339 date/time string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DateTime(Date date, TimeZone zone)
public DateTime(long value)
public DateTime(Date value)
public DateTime(long value, Integer tzShift)
public DateTime(boolean dateOnly, long value, Integer tzShift)
public DateTime(String value)
DateTime
from an RFC 3339
date/time value.
Method Detail |
---|
public long getValue()
If the time zone is specified, this value is normalized to UTC, so to format this date/time value, the time zone shift has to be applied.
public boolean isDateOnly()
public Integer getTimeZoneShift()
null
for local time zone.
public String toStringRfc3339()
public String toString()
toString
in class Object
public boolean equals(Object o)
Upgrade warning: starting with version 1.11 a check is added that the time zone is the same.
This may break some existing equality checks. If you ONLY want to check equality of time value,
check equality on the getValue()
.
equals
in class Object
public static DateTime parseRfc3339(String str) throws NumberFormatException
Upgrade warning: starting with version 1.11, for the date-only case the time zone is ignored and the hourOfDay, minute, second, and millisecond parameters are set to zero.
NumberFormatException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |