Class XMPDateTime

java.lang.Object
com.adobe.xmp.core.XMPDateTime
All Implemented Interfaces:
Comparable<XMPDateTime>

public class XMPDateTime extends Object implements 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 Details

    • XMPDateTime

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

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

      public XMPDateTime(Date date, 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(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 Details