public class DateTime extends Object implements Comparable<Object>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
dateOnly
Specifies whether this is a date-only value.
|
static Pattern |
datePattern
XML date pattern.
|
static Pattern |
dateTimeChoicePattern
XML date/time or date pattern.
|
static Pattern |
dateTimePattern
XML date/time pattern.
|
protected Integer |
tzShift
Time zone shift from UTC in minutes.
|
protected long |
value
Date/time value expressed as the number of ms since the Unix epoch.
|
| Constructor and Description |
|---|
DateTime() |
DateTime(Date value) |
DateTime(Date value,
TimeZone zone) |
DateTime(long value) |
DateTime(long value,
int tzShift) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Object o) |
boolean |
equals(Object o)
Compares instance with DateTime or Date objects.
|
Integer |
getTzShift() |
long |
getValue() |
int |
hashCode() |
boolean |
isDateOnly() |
static DateTime |
now() |
static DateTime |
parseDate(String str)
Parses an xs:date string.
|
static DateTime |
parseDateTime(String str)
Parses an xs:dateTime string.
|
static DateTime |
parseDateTimeChoice(String value)
Parses an XML value that's either an xs:date or xs:dateTime string.
|
static DateTime |
parseRfc822(String str)
Parses the value as an RFC 822 date/time.
|
void |
setDateOnly(boolean v) |
void |
setTzShift(Integer v) |
void |
setValue(long v) |
String |
toString()
Formats the value as an xs:date or xs:dateTime string.
|
String |
toStringRfc822()
Formats the value as an RFC 822 date/time.
|
String |
toUiString()
Formats the value as a human-readable string.
|
protected long value
protected boolean dateOnly
protected Integer tzShift
null, no time zone
is set, and the time is always interpreted as local time.public static final Pattern dateTimePattern
public static final Pattern datePattern
public static final Pattern dateTimeChoicePattern
public DateTime()
public DateTime(long value)
public DateTime(Date value)
public DateTime(long value,
int tzShift)
public static DateTime now()
public long getValue()
public void setValue(long v)
public boolean isDateOnly()
public void setDateOnly(boolean v)
public Integer getTzShift()
public void setTzShift(Integer v)
public boolean equals(Object o)
public int compareTo(Object o)
compareTo in interface Comparable<Object>public String toString()
public String toStringRfc822()
public static DateTime parseRfc822(String str) throws ParseException
ParseExceptionpublic String toUiString()
public static DateTime parseDateTime(String str) throws NumberFormatException
NumberFormatExceptionpublic static DateTime parseDate(String str) throws NumberFormatException
NumberFormatExceptionpublic static DateTime parseDateTimeChoice(String value) throws NumberFormatException
NumberFormatException - Invalid RFC 3339 date or date/time string.Copyright © 2012. All Rights Reserved.