Package com.adobe.xmp.core
Class XMPDateTime
- java.lang.Object
-
- com.adobe.xmp.core.XMPDateTime
-
- All Implemented Interfaces:
java.lang.Comparable<XMPDateTime>
public class XMPDateTime extends java.lang.Object implements java.lang.Comparable<XMPDateTime>
TheXMPDateTime
-class represents a point in time up to a resolution of nano seconds. Dates and time in the serialized XMP are ISO 8601 strings. There are utility functions to convert to the ISO format, aCalendar
or get the Timezone. The fields ofXMPDateTime
are:- month - The month in the range 1..12.
- day - The day of the month in the range 1..31.
- minute - The minute in the range 0..59.
- hour - The time zone hour in the range 0..23.
- minute - The time zone minute in the range 0..59.
- nanoSecond - The nano seconds within a second. Note: if the XMPDateTime is converted into a calendar, the resolution is reduced to milli seconds.
- timeZone - a
TimeZone
-object.
-
-
Constructor Summary
Constructors Constructor Description XMPDateTime()
Creates anXMPDateTime
-instance with the current time in the default time zone.XMPDateTime(int year, int month, int day)
Creates anXMPDateTime
-object from initial values.XMPDateTime(int year, int month, int day, int hour, int minute, int second, int nanoSecond)
Creates anXMPDateTime
-object from initial values.XMPDateTime(java.lang.String strValue)
Creates anXMPDateTime
-instance from an ISO 8601 string.XMPDateTime(java.util.Calendar calendar)
Creates anXMPDateTime
-instance from a calendar.XMPDateTime(java.util.Date date, java.util.TimeZone timeZone)
Creates anXMPDateTime
-instance from aDate
and aTimeZone
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(XMPDateTime dt)
java.util.Calendar
getCalendar()
int
getDay()
int
getHour()
java.lang.String
getISO8601String()
int
getMinute()
int
getMonth()
int
getNanoSecond()
int
getSecond()
java.util.TimeZone
getTimeZone()
int
getYear()
boolean
hasDate()
boolean
hasTime()
boolean
hasTimeZone()
void
setDay(int day)
void
setHour(int hour)
void
setMinute(int minute)
void
setMonth(int month)
void
setNanoSecond(int nanoSecond)
void
setSecond(int second)
void
setTimeZone(java.util.TimeZone timeZone)
void
setYear(int year)
java.lang.String
toString()
-
-
-
Constructor Detail
-
XMPDateTime
public XMPDateTime()
Creates anXMPDateTime
-instance with the current time in the default time zone.
-
XMPDateTime
public XMPDateTime(java.util.Calendar calendar)
Creates anXMPDateTime
-instance from a calendar.- Parameters:
calendar
- aCalendar
-
XMPDateTime
public XMPDateTime(java.util.Date date, java.util.TimeZone timeZone)
Creates anXMPDateTime
-instance from aDate
and aTimeZone
.- Parameters:
date
- a date describing an absolute point in timetimeZone
- a TimeZone how to interpret the date
-
XMPDateTime
public XMPDateTime(java.lang.String strValue) throws XMPException
Creates anXMPDateTime
-instance from an ISO 8601 string.- Parameters:
strValue
- an ISO 8601 string- Throws:
XMPException
- If the string is a non-conform ISO 8601 string, an exception is thrown
-
XMPDateTime
public XMPDateTime(int year, int month, int day)
Creates anXMPDateTime
-object from initial values.- Parameters:
year
- yearsmonth
- months from 1 to 12
Note: Remember that the month inCalendar
is defined from 0 to 11.day
- days
-
XMPDateTime
public XMPDateTime(int year, int month, int day, int hour, int minute, int second, int nanoSecond)
Creates anXMPDateTime
-object from initial values.- Parameters:
year
- yearsmonth
- months from 1 to 12
Note: Remember that the month inCalendar
is defined from 0 to 11.day
- dayshour
- hoursminute
- minutessecond
- secondsnanoSecond
- nanoseconds
-
-
Method Detail
-
getYear
public int getYear()
- See Also:
getYear()
-
setYear
public void setYear(int year)
- See Also:
setYear(int)
-
getMonth
public int getMonth()
- See Also:
getMonth()
-
setMonth
public void setMonth(int month)
- See Also:
setMonth(int)
-
getDay
public int getDay()
- See Also:
getDay()
-
setDay
public void setDay(int day)
- See Also:
setDay(int)
-
getHour
public int getHour()
- See Also:
getHour()
-
setHour
public void setHour(int hour)
- See Also:
setHour(int)
-
getMinute
public int getMinute()
- See Also:
getMinute()
-
setMinute
public void setMinute(int minute)
- See Also:
setMinute(int)
-
getSecond
public int getSecond()
- See Also:
getSecond()
-
setSecond
public void setSecond(int second)
- See Also:
setSecond(int)
-
getNanoSecond
public int getNanoSecond()
- See Also:
getNanoSecond()
-
setNanoSecond
public void setNanoSecond(int nanoSecond)
- See Also:
setNanoSecond(int)
-
compareTo
public int compareTo(XMPDateTime dt)
- Specified by:
compareTo
in interfacejava.lang.Comparable<XMPDateTime>
- See Also:
Comparable.compareTo(Object)
-
getTimeZone
public java.util.TimeZone getTimeZone()
- See Also:
getTimeZone()
-
setTimeZone
public void setTimeZone(java.util.TimeZone timeZone)
- See Also:
setTimeZone(TimeZone)
-
hasDate
public boolean hasDate()
- See Also:
hasDate()
-
hasTime
public boolean hasTime()
- See Also:
hasTime()
-
hasTimeZone
public boolean hasTimeZone()
- See Also:
hasTimeZone()
-
getCalendar
public java.util.Calendar getCalendar()
- See Also:
getCalendar()
-
getISO8601String
public java.lang.String getISO8601String()
- See Also:
getISO8601String()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- Returns the ISO string representation.
-
-