Package com.adobe.xmp

Class XMPDateTimeFactory


  • public final class XMPDateTimeFactory
    extends java.lang.Object
    A factory to create XMPDateTime-instances from a Calendar or an ISO 8601 string or for the current time.
    Since:
    16.02.2006
    • Method Detail

      • createFromCalendar

        public static XMPDateTime createFromCalendar​(java.util.Calendar calendar)
        Creates an XMPDateTime from a Calendar-object.
        Parameters:
        calendar - a Calendar-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 an XMPDateTime-object from initial values.
        Parameters:
        year - years
        month - months from 1 to 12
        Note: Remember that the month in Calendar is defined from 0 to 11.
        day - days
        hour - hours
        minute - minutes
        second - seconds
        nanoSecond - nanoseconds
        Returns:
        Returns an XMPDateTime-object.
      • createFromISO8601

        public static XMPDateTime createFromISO8601​(java.lang.String strValue)
                                             throws XMPException
        Creates an XMPDateTime 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 - the XMPDateTime 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 - the XMPDateTime 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 - the XMPDateTime variable containing the time to be modified.
        Returns:
        Returns an updated XMPDateTime-object.