public class XMPDateTimeImpl extends Object implements XMPDateTime
XMPDateTime
. Internally a calendar
is used plus an additional nano seconds field, because Calendar
supports only milli seconds. The nanoSeconds
convers only the resolution beyond a milli second.
Constructor and Description |
---|
XMPDateTimeImpl()
Creates an XMPDateTime -instance with the current time in the default time zone.
|
XMPDateTimeImpl(Calendar calendar)
Creates an XMPDateTime -instance from a calendar.
|
XMPDateTimeImpl(Date date, TimeZone timeZone)
Creates an XMPDateTime -instance from a Date and a TimeZone .
|
XMPDateTimeImpl(String strValue)
Creates an XMPDateTime -instance from an ISO 8601 string.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object dt) |
Calendar |
getCalendar() |
int |
getDay() |
int |
getHour() |
String |
getISO8601String() |
int |
getMinute() |
int |
getMonth() |
int |
getNanoSecond() |
int |
getSecond() |
TimeZone |
getTimeZone() |
int |
getYear() |
boolean |
hasDate()
This flag is set either by parsing or by setting year, month or day.
|
boolean |
hasTime()
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.
|
boolean |
hasTimeZone()
This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.
|
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(TimeZone timeZone) |
void |
setYear(int year) |
String |
toString() |
public XMPDateTimeImpl()
XMPDateTime
-instance with the current time in the default time zone.
public XMPDateTimeImpl(Calendar calendar)
XMPDateTime
-instance from a calendar.
calendar
- a Calendar
public XMPDateTimeImpl(Date date, TimeZone timeZone)
XMPDateTime
-instance from a Date
and a TimeZone
.
date
- a date describing an absolute point in time
timeZone
- a TimeZone how to interpret the date
public XMPDateTimeImpl(String strValue) throws XMPException
XMPDateTime
-instance from an ISO 8601 string.
strValue
- an ISO 8601 string
XMPException
- If the string is a non-conform ISO 8601 string, an exception is thrown
public int getYear()
getYear
in interface XMPDateTime
XMPDateTime.getYear()
public void setYear(int year)
setYear
in interface XMPDateTime
year
- Sets the year
XMPDateTime.setYear(int)
public int getMonth()
getMonth
in interface XMPDateTime
XMPDateTime.getMonth()
public void setMonth(int month)
setMonth
in interface XMPDateTime
month
- Sets the month 1..12
XMPDateTime.setMonth(int)
public int getDay()
getDay
in interface XMPDateTime
XMPDateTime.getDay()
public void setDay(int day)
setDay
in interface XMPDateTime
day
- Sets the day 1..31
XMPDateTime.setDay(int)
public int getHour()
getHour
in interface XMPDateTime
XMPDateTime.getHour()
public void setHour(int hour)
setHour
in interface XMPDateTime
hour
- Sets the hour in the range 0..23.
XMPDateTime.setHour(int)
public int getMinute()
getMinute
in interface XMPDateTime
XMPDateTime.getMinute()
public void setMinute(int minute)
setMinute
in interface XMPDateTime
minute
- Sets the minute in the range 0..59.
XMPDateTime.setMinute(int)
public int getSecond()
getSecond
in interface XMPDateTime
XMPDateTime.getSecond()
public void setSecond(int second)
setSecond
in interface XMPDateTime
second
- Sets the second in the range 0..59.
XMPDateTime.setSecond(int)
public int getNanoSecond()
getNanoSecond
in interface XMPDateTime
XMPDateTime.getNanoSecond()
public void setNanoSecond(int nanoSecond)
setNanoSecond
in interface XMPDateTime
nanoSecond
- Sets the milli-, micro- and nano seconds. Granularity goes down to milli seconds.
XMPDateTime.setNanoSecond(int)
public int compareTo(Object dt)
compareTo
in interface Comparable
Comparable.compareTo(Object)
public TimeZone getTimeZone()
getTimeZone
in interface XMPDateTime
XMPDateTime.getTimeZone()
public void setTimeZone(TimeZone timeZone)
setTimeZone
in interface XMPDateTime
timeZone
- a time zone to set
XMPDateTime.setTimeZone(TimeZone)
public boolean hasDate()
XMPDateTime
hasDate
in interface XMPDateTime
XMPDateTime.hasDate()
public boolean hasTime()
XMPDateTime
hasTime
in interface XMPDateTime
XMPDateTime.hasTime()
public boolean hasTimeZone()
XMPDateTime
hasTimeZone
in interface XMPDateTime
XMPDateTime.hasTimeZone()
public Calendar getCalendar()
getCalendar
in interface XMPDateTime
Calendar
(only with milli second precision).
XMPDateTime.getCalendar()
public String getISO8601String()
getISO8601String
in interface XMPDateTime
XMPDateTime.getISO8601String()
Copyright © 1998–2022. All rights reserved.