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 XMPDateTime
convertToLocalTime
(XMPDateTime dateTime) Make sure a time is local.static XMPDateTime
convertToUTCTime
(XMPDateTime dateTime) Make sure a time is UTC.static XMPDateTime
create()
Creates an emptyXMPDateTime
-object.static XMPDateTime
create
(int year, int month, int day) Creates anXMPDateTime
-object from initial values.static XMPDateTime
create
(int year, int month, int day, int hour, int minute, int second, int nanoSecond) Creates anXMPDateTime
-object from initial values.static XMPDateTime
createFromCalendar
(Calendar calendar) Creates anXMPDateTime
from aCalendar
-object.static XMPDateTime
createFromISO8601
(String strValue) Creates anXMPDateTime
from an ISO 8601 string.static XMPDateTime
Obtain the current date and time.static XMPDateTime
setLocalTimeZone
(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 anXMPDateTime
from 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 inCalendar
is 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 inCalendar
is defined from 0 to 11. -
day
- days -
hour
- hours -
minute
- minutes -
second
- seconds -
nanoSecond
- nanoseconds - Returns:
-
Returns an
XMPDateTime
-object.
-
createFromISO8601
Creates anXMPDateTime
from 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
- theXMPDateTime
variable 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
- theXMPDateTime
variable 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
- theXMPDateTime
variable containing the time to be modified. - Returns:
-
Returns an updated
XMPDateTime
-object.
-