Class MCRISO8601Date

java.lang.Object
org.mycore.datamodel.common.MCRISO8601Date

public class MCRISO8601Date extends Object
holds info about a specific point in time. This class is used for handling ISO 8601 like date and dateTime formatted strings.
Author:
Thomas Scheffler (yagee)
  • Field Details

  • Constructor Details

    • MCRISO8601Date

      public MCRISO8601Date()
      creates an empty instance. use setDate(String) to parse a date/time by this instance.
    • MCRISO8601Date

      public MCRISO8601Date(String isoString)
      Parameters:
      isoString - a date or dateTime string as defined on W3C Page
  • Method Details

    • now

      public static MCRISO8601Date now()
    • format

      public String format(String format, Locale locale)
      formats the date to a String.
      Parameters:
      format - as in MCRISO8601Format
      locale - used by format process
      Returns:
      null if date is not set yet
    • format

      public String format(String format, Locale locale, String timeZone)
      formats the date to a String.
      Parameters:
      format - as in MCRISO8601Format
      locale - used by format process
      timeZone - valid timeZone id, e.g. "Europe/Berlin", or null
      Returns:
      null if date is not set yet
    • getDate

      public final Date getDate()
      returns the Date representing this element.
      Returns:
      a new Date instance of the time set in this element
    • getDt

      public TemporalAccessor getDt()
      Returns:
      the dt
    • getIsoFormat

      public MCRISO8601Format getIsoFormat()
      Returns:
      the isoFormat
    • getISOString

      public final String getISOString()
      returns a ISO 8601 conform String using the current set format.
      Returns:
      date in ISO 8601 format, or null if date is unset.
    • setDate

      public void setDate(Date dt)
      sets the date for this meta data object.
      Parameters:
      dt - Date object representing date String in Element
    • setDate

      public final void setDate(String isoString)
      sets the date for this meta data object
      Parameters:
      isoString - Date in any form that is a valid W3C dateTime
    • setFormat

      public void setFormat(MCRISO8601Format isoFormat)
      sets the input and output format. please use only the formats defined on the W3C Page, which are also exported as static fields by this class.
    • setFormat

      public void setFormat(String format)
      sets the input and output format. please use only the formats defined on the W3C Page, which are also exported as static fields by this class.
      Parameters:
      format - a format string that is valid conforming to xsd:duration schema type.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object