public final class AtomDate extends Object implements Cloneable, Serializable
Provides an implementation of the Atom Date Construct, which is itself a specialization of the RFC3339 date-time.
Accessors on this class are not synchronized.
Per RFC4287:
3.3. Date Constructs
A Date construct is an element whose content MUST conform to the
"date-time" production in [RFC3339]. In addition, an uppercase "T"
character MUST be used to separate date and time, and an uppercase
"Z" character MUST be present in the absence of a numeric time zone
offset.
atomDateConstruct =
atomCommonAttributes,
xsd:dateTime
Such date values happen to be compatible with the following
specifications: [ISO.8601.1988], [W3C.NOTE-datetime-19980827], and
[W3C.REC-xmlschema-2-20041028].
Example Date constructs:
<updated>2003-12-13T18:30:02Z</updated>
<updated>2003-12-13T18:30:02.25Z</updated>
<updated>2003-12-13T18:30:02+01:00</updated>
<updated>2003-12-13T18:30:02.25+01:00</updated>
Date values SHOULD be as accurate as possible. For example, it would
be generally inappropriate for a publishing system to apply the same
timestamp to several entries that were published during the course of
a single day.
| Constructor and Description |
|---|
AtomDate()
Create an AtomDate using the current date and time
|
AtomDate(Calendar value)
Create an AtomDate using a java.util.Calendar.
|
AtomDate(Date value)
Create an AtomDate using a java.util.Date
|
AtomDate(long value)
Create an AtomDate using the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
AtomDate(String value)
Create an AtomDate using the serialized string format (e.g.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
boolean |
equals(Object obj) |
static String |
format(Date date)
Create the serialized string form from a java.util.Date
|
Calendar |
getCalendar()
Returns the value of this Atom Date as a java.util.Calendar
|
Date |
getDate()
Returns the value of this Atom Date
|
long |
getTime()
Returns the value of this Atom Date as the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
String |
getValue()
Return the serialized string form of the Atom date
|
int |
hashCode() |
static Date |
parse(String date)
Parse the serialized string form into a java.util.Date
|
AtomDate |
setValue(Calendar calendar)
Sets the value of the Atom date using java.util.Calendar
|
AtomDate |
setValue(Date date)
Sets the value of the Atom date using java.util.Date
|
AtomDate |
setValue(long timestamp)
Sets the value of the Atom date using the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
AtomDate |
setValue(String value)
Sets the value of the Atom date using the serialized string form
|
String |
toString() |
static AtomDate |
valueOf(Calendar value)
Create a new Atom Date instance from a java.util.Calendar
|
static AtomDate |
valueOf(Date value)
Create a new Atom Date instance from a java.util.Date
|
static AtomDate |
valueOf(long value)
Create a new Atom Date instance using the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
static AtomDate |
valueOf(String value)
Create a new Atom Date instance from the serialized string form
|
public AtomDate()
public AtomDate(String value)
value - The serialized RFC3339 date/time valuepublic AtomDate(Date value)
value - The java.util.Date valueNullPointerException - if date is nullpublic AtomDate(Calendar value)
value - The java.util.Calendar valueNullPointerException - if value is nullpublic AtomDate(long value)
value - The number of milliseconds since January 1, 1970, 00:00:00 GMTpublic String getValue()
public AtomDate setValue(String value)
value - The serialized string form of the datepublic AtomDate setValue(Date date)
date - A java.util.DateNullPointerException - if date is nullpublic AtomDate setValue(Calendar calendar)
calendar - a java.util.Calendarpublic AtomDate setValue(long timestamp)
timestamp - The number of milliseconds since January 1, 1970, 00:00:00 GMTpublic Date getDate()
public Calendar getCalendar()
public long getTime()
public static Date parse(String date)
date - The serialized string form of the datepublic static String format(Date date)
d - A java.util.Datepublic static AtomDate valueOf(String value)
value - The serialized string form of the datepublic static AtomDate valueOf(Date value)
value - a java.util.Datepublic static AtomDate valueOf(Calendar value)
value - A java.util.Calendarpublic static AtomDate valueOf(long value)
value - The number of milliseconds since January 1, 1970, 00:00:00 GMTCopyright © 2010 - 2020 Adobe. All Rights Reserved