Package com.itextpdf.kernel.xmp.impl
Class XMPDateTimeImpl
java.lang.Object
com.itextpdf.kernel.xmp.impl.XMPDateTimeImpl
- All Implemented Interfaces:
-
XMPDateTime,Comparable
The implementation of
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.
- Since:
- 16.02.2006
-
Constructor Summary
ConstructorsConstructorDescriptionCreates anXMPDateTime-instance with the current time in the default time zone.XMPDateTimeImpl(String strValue) Creates anXMPDateTime-instance from an ISO 8601 string.XMPDateTimeImpl(Calendar calendar) Creates anXMPDateTime-instance from a calendar.XMPDateTimeImpl(Date date, TimeZone timeZone) Creates anXMPDateTime-instance from aDateand aTimeZone. -
Method Summary
Modifier and TypeMethodDescriptionintintgetDay()intgetHour()intintgetMonth()intintintgetYear()booleanhasDate()This flag is set either by parsing or by setting year, month or day.booleanhasTime()This flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.booleanThis flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.voidsetDay(int day) voidsetHour(int hour) voidsetMinute(int minute) voidsetMonth(int month) voidsetNanoSecond(int nanoSecond) voidsetSecond(int second) voidsetTimeZone(TimeZone timeZone) voidsetYear(int year) toString()
-
Constructor Details
-
XMPDateTimeImpl
public XMPDateTimeImpl()Creates anXMPDateTime-instance with the current time in the default time zone. -
XMPDateTimeImpl
Creates anXMPDateTime-instance from a calendar.- Parameters:
-
calendar- aCalendar
-
XMPDateTimeImpl
Creates anXMPDateTime-instance from aDateand aTimeZone.- Parameters:
-
date- a date describing an absolute point in time -
timeZone- a TimeZone how to interpret the date
-
XMPDateTimeImpl
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
-
-
Method Details
-
getYear
public int getYear()- Specified by:
-
getYearin interfaceXMPDateTime - Returns:
- Returns the year, can be negative.
- See Also:
-
setYear
public void setYear(int year) - Specified by:
-
setYearin interfaceXMPDateTime - Parameters:
-
year- Sets the year - See Also:
-
getMonth
public int getMonth()- Specified by:
-
getMonthin interfaceXMPDateTime - Returns:
- Returns The month in the range 1..12.
- See Also:
-
setMonth
public void setMonth(int month) - Specified by:
-
setMonthin interfaceXMPDateTime - Parameters:
-
month- Sets the month 1..12 - See Also:
-
getDay
public int getDay()- Specified by:
-
getDayin interfaceXMPDateTime - Returns:
- Returns the day of the month in the range 1..31.
- See Also:
-
setDay
public void setDay(int day) - Specified by:
-
setDayin interfaceXMPDateTime - Parameters:
-
day- Sets the day 1..31 - See Also:
-
getHour
public int getHour()- Specified by:
-
getHourin interfaceXMPDateTime - Returns:
- Returns hour - The hour in the range 0..23.
- See Also:
-
setHour
public void setHour(int hour) - Specified by:
-
setHourin interfaceXMPDateTime - Parameters:
-
hour- Sets the hour in the range 0..23. - See Also:
-
getMinute
public int getMinute()- Specified by:
-
getMinutein interfaceXMPDateTime - Returns:
- Returns the minute in the range 0..59.
- See Also:
-
setMinute
public void setMinute(int minute) - Specified by:
-
setMinutein interfaceXMPDateTime - Parameters:
-
minute- Sets the minute in the range 0..59. - See Also:
-
getSecond
public int getSecond()- Specified by:
-
getSecondin interfaceXMPDateTime - Returns:
- Returns the second in the range 0..59.
- See Also:
-
setSecond
public void setSecond(int second) - Specified by:
-
setSecondin interfaceXMPDateTime - Parameters:
-
second- Sets the second in the range 0..59. - See Also:
-
getNanoSecond
public int getNanoSecond()- Specified by:
-
getNanoSecondin interfaceXMPDateTime - Returns:
- Returns milli-, micro- and nano seconds. Nanoseconds within a second, often left as zero?
- See Also:
-
setNanoSecond
public void setNanoSecond(int nanoSecond) - Specified by:
-
setNanoSecondin interfaceXMPDateTime - Parameters:
-
nanoSecond- Sets the milli-, micro- and nano seconds. Granularity goes down to milli seconds. - See Also:
-
compareTo
- Specified by:
-
compareToin interfaceComparable - See Also:
-
getTimeZone
- Specified by:
-
getTimeZonein interfaceXMPDateTime - Returns:
- Returns the time zone.
- See Also:
-
setTimeZone
- Specified by:
-
setTimeZonein interfaceXMPDateTime - Parameters:
-
timeZone- a time zone to set - See Also:
-
hasDate
public boolean hasDate()Description copied from interface:XMPDateTimeThis flag is set either by parsing or by setting year, month or day.- Specified by:
-
hasDatein interfaceXMPDateTime - Returns:
- Returns true if the XMPDateTime object has a date portion.
- See Also:
-
hasTime
public boolean hasTime()Description copied from interface:XMPDateTimeThis flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.- Specified by:
-
hasTimein interfaceXMPDateTime - Returns:
- Returns true if the XMPDateTime object has a time portion.
- See Also:
-
hasTimeZone
public boolean hasTimeZone()Description copied from interface:XMPDateTimeThis flag is set either by parsing or by setting hours, minutes, seconds or milliseconds.- Specified by:
-
hasTimeZonein interfaceXMPDateTime - Returns:
- Returns true if the XMPDateTime object has a defined timezone.
- See Also:
-
getCalendar
- Specified by:
-
getCalendarin interfaceXMPDateTime - Returns:
-
Returns a
Calendar(only with milli second precision).
Note: the dates before Oct 15th 1585 (which normally fall into validity of the Julian calendar) are also rendered internally as Gregorian dates. - See Also:
-
getISO8601String
- Specified by:
-
getISO8601Stringin interfaceXMPDateTime - Returns:
- Returns the ISO 8601 string representation of the date and time.
- See Also:
-
toString
-