Class XMPDateTime

  • All Implemented Interfaces:
    java.lang.Comparable<XMPDateTime>

    public class XMPDateTime
    extends java.lang.Object
    implements java.lang.Comparable<XMPDateTime>
    The XMPDateTime-class represents a point in time up to a resolution of nano seconds. Dates and time in the serialized XMP are ISO 8601 strings. There are utility functions to convert to the ISO format, a Calendar or get the Timezone. The fields of XMPDateTime are:
    • month - The month in the range 1..12.
    • day - The day of the month in the range 1..31.
    • minute - The minute in the range 0..59.
    • hour - The time zone hour in the range 0..23.
    • minute - The time zone minute in the range 0..59.
    • nanoSecond - The nano seconds within a second. Note: if the XMPDateTime is converted into a calendar, the resolution is reduced to milli seconds.
    • timeZone - a TimeZone-object.
    DateTime values are occasionally used in cases with only a date or only a time component. A date without a time has zeros for all the time fields. A time without a date has zeros for all date fields (year, month, and day).
    • Constructor Detail

      • XMPDateTime

        public XMPDateTime()
        Creates an XMPDateTime-instance with the current time in the default time zone.
      • XMPDateTime

        public XMPDateTime​(java.util.Calendar calendar)
        Creates an XMPDateTime-instance from a calendar.
        Parameters:
        calendar - a Calendar
      • XMPDateTime

        public XMPDateTime​(java.util.Date date,
                           java.util.TimeZone timeZone)
        Creates an XMPDateTime-instance from a Date and a TimeZone.
        Parameters:
        date - a date describing an absolute point in time
        timeZone - a TimeZone how to interpret the date
      • XMPDateTime

        public XMPDateTime​(java.lang.String strValue)
                    throws XMPException
        Creates an XMPDateTime-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
      • XMPDateTime

        public XMPDateTime​(int year,
                           int month,
                           int day)
        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
      • XMPDateTime

        public XMPDateTime​(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
    • Method Detail

      • getYear

        public int getYear()
        See Also:
        getYear()
      • setYear

        public void setYear​(int year)
        See Also:
        setYear(int)
      • getMonth

        public int getMonth()
        See Also:
        getMonth()
      • setMonth

        public void setMonth​(int month)
        See Also:
        setMonth(int)
      • getDay

        public int getDay()
        See Also:
        getDay()
      • setDay

        public void setDay​(int day)
        See Also:
        setDay(int)
      • getHour

        public int getHour()
        See Also:
        getHour()
      • setHour

        public void setHour​(int hour)
        See Also:
        setHour(int)
      • getMinute

        public int getMinute()
        See Also:
        getMinute()
      • setMinute

        public void setMinute​(int minute)
        See Also:
        setMinute(int)
      • getSecond

        public int getSecond()
        See Also:
        getSecond()
      • setSecond

        public void setSecond​(int second)
        See Also:
        setSecond(int)
      • setNanoSecond

        public void setNanoSecond​(int nanoSecond)
        See Also:
        setNanoSecond(int)
      • compareTo

        public int compareTo​(XMPDateTime dt)
        Specified by:
        compareTo in interface java.lang.Comparable<XMPDateTime>
        See Also:
        Comparable.compareTo(Object)
      • getTimeZone

        public java.util.TimeZone getTimeZone()
        See Also:
        getTimeZone()
      • hasDate

        public boolean hasDate()
        See Also:
        hasDate()
      • hasTime

        public boolean hasTime()
        See Also:
        hasTime()
      • hasTimeZone

        public boolean hasTimeZone()
        See Also:
        hasTimeZone()
      • getCalendar

        public java.util.Calendar getCalendar()
        See Also:
        getCalendar()
      • getISO8601String

        public java.lang.String getISO8601String()
        See Also:
        getISO8601String()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        Returns the ISO string representation.