Package com.itextpdf.kernel.xmp
Class XMPDateTimeFactory
java.lang.Object
com.itextpdf.kernel.xmp.XMPDateTimeFactory
A factory to create
XMPDateTime-instances from a Calendar or an ISO 8601 string or for the current time.
- Since:
- 16.02.2006
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMPDateTimeconvertToLocalTime(XMPDateTime dateTime) Make sure a time is local.static XMPDateTimeconvertToUTCTime(XMPDateTime dateTime) Make sure a time is UTC.static XMPDateTimecreate()Creates an emptyXMPDateTime-object.static XMPDateTimecreate(int year, int month, int day) Creates anXMPDateTime-object from initial values.static XMPDateTimecreate(int year, int month, int day, int hour, int minute, int second, int nanoSecond) Creates anXMPDateTime-object from initial values.static XMPDateTimecreateFromCalendar(Calendar calendar) Creates anXMPDateTimefrom aCalendar-object.static XMPDateTimecreateFromISO8601(String strValue) Creates anXMPDateTimefrom an ISO 8601 string.static XMPDateTimeObtain the current date and time.static XMPDateTimesetLocalTimeZone(XMPDateTime dateTime) Sets the local time zone without touching any other Any existing time zone value is replaced, the other date/time fields are not adjusted in any way.
-
Method Details
-
createFromCalendar
Creates anXMPDateTimefrom aCalendar-object.- Parameters:
-
calendar- aCalendar-object. - Returns:
-
An
XMPDateTime-object.
-
create
Creates an emptyXMPDateTime-object.- Returns:
-
Returns an
XMPDateTime-object.
-
create
Creates anXMPDateTime-object from initial values.- Parameters:
-
year- years -
month- months from 1 to 12
Note: Remember that the month inCalendaris defined from 0 to 11. -
day- days - Returns:
-
Returns an
XMPDateTime-object.
-
create
public static XMPDateTime create(int year, int month, int day, int hour, int minute, int second, int nanoSecond) Creates anXMPDateTime-object from initial values.- Parameters:
-
year- years -
month- months from 1 to 12
Note: Remember that the month inCalendaris defined from 0 to 11. -
day- days -
hour- hours -
minute- minutes -
second- seconds -
nanoSecond- nanoseconds - Returns:
-
Returns an
XMPDateTime-object.
-
createFromISO8601
Creates anXMPDateTimefrom an ISO 8601 string.- Parameters:
-
strValue- The ISO 8601 string representation of the date/time. - Returns:
-
An
XMPDateTime-object. - Throws:
-
XMPException- When the ISO 8601 string is non-conform
-
getCurrentDateTime
Obtain the current date and time.- Returns:
- Returns The returned time is UTC, properly adjusted for the local time zone. The resolution of the time is not guaranteed to be finer than seconds.
-
setLocalTimeZone
Sets the local time zone without touching any other Any existing time zone value is replaced, the other date/time fields are not adjusted in any way.- Parameters:
-
dateTime- theXMPDateTimevariable containing the value to be modified. - Returns:
-
Returns an updated
XMPDateTime-object.
-
convertToUTCTime
Make sure a time is UTC. If the time zone is not UTC, the time is adjusted and the time zone set to be UTC.- Parameters:
-
dateTime- theXMPDateTimevariable containing the time to be modified. - Returns:
-
Returns an updated
XMPDateTime-object.
-
convertToLocalTime
Make sure a time is local. If the time zone is not the local zone, the time is adjusted and the time zone set to be local.- Parameters:
-
dateTime- theXMPDateTimevariable containing the time to be modified. - Returns:
-
Returns an updated
XMPDateTime-object.
-