Package com.adobe.xmp
Class XMPDateTimeFactory
- java.lang.Object
-
- com.adobe.xmp.XMPDateTimeFactory
-
public final class XMPDateTimeFactory extends java.lang.Object
A factory to createXMPDateTime
-instances from aCalendar
or an ISO 8601 string or for the current time.- Since:
- 16.02.2006
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static XMPDateTime
convertToLocalTime(XMPDateTime dateTime)
Make sure a time is local.static XMPDateTime
convertToUTCTime(XMPDateTime dateTime)
Make sure a time is UTC.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(java.util.Calendar calendar)
Creates anXMPDateTime
from aCalendar
-object.static XMPDateTime
createFromISO8601(java.lang.String strValue)
Creates anXMPDateTime
from an ISO 8601 string.static XMPDateTime
getCurrentDateTime()
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 Detail
-
createFromCalendar
public static XMPDateTime createFromCalendar(java.util.Calendar calendar)
Creates anXMPDateTime
from aCalendar
-object.- Parameters:
calendar
- aCalendar
-object.- 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
- yearsmonth
- months from 1 to 12
Note: Remember that the month inCalendar
is defined from 0 to 11.day
- dayshour
- hoursminute
- minutessecond
- secondsnanoSecond
- nanoseconds- Returns:
- Returns an
XMPDateTime
-object.
-
createFromISO8601
public static XMPDateTime createFromISO8601(java.lang.String strValue) throws XMPException
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
public static XMPDateTime 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
public 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.- Parameters:
dateTime
- theXMPDateTime
variable containing the value to be modified.- Returns:
- Returns an updated
XMPDateTime
-object.
-
convertToUTCTime
public static XMPDateTime convertToUTCTime(XMPDateTime dateTime)
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
public static XMPDateTime convertToLocalTime(XMPDateTime dateTime)
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.
-
-