Class ISODateTime

java.lang.Object
com.adobe.xfa.ut.ISODateTime

public class ISODateTime extends Object
The class ISODateTime is a convenience class grouping the ISODate and ISOTime classes, to define objects in support of ISO8601/XFA date time patterns.

A valid ISO8601/XFA date time string is the concatenation of a valid ISO8601/XFA date string and a valid ISO8601/XFA time string with the letter 'T' acting as a separator between the date and time elements of the string. See ISODate and ISOTime for the definitions of valid ISO8601/XFA date and time patterns. Here's a snippet of code illustrating the use of ISODateTime to reformat an ISO8601/XFA datetime string


      #include <pub/ut/isodatetime.h>       // for defn of ISODateTime.
      #include <pub/ut/string.h>            // for defn of String.
      ...
      ISODateTime dt("2000-02-28T11:12:13-05:00");
      String s("Unknown");
      if (dt.isValid())
          s = dt.format(ISODateTime.getXFA_DATETIME_FMT1());
      printf("%S\n", (const wchar_t *) s);
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    An ISO8601/XFA date time pattern string: YYYYMMDDTHHMMSS.FFFz.
    static final String
    An alternate ISO8601/XFA date time pattern string: YYYY-MM-DDTHH:MM:SS.FFFzz.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate an ISODateTime object from today's date and time.
    ISODateTime(String datetime, String datelocale, String timelocale)
    Instantiate an ISODateTime object from the given date time string.
  • Method Summary

    Modifier and Type
    Method
    Description
    format(String isoformat)
    Format this object given the ISO datetime format string.
    Get date component of this object
    Get time component of this object
    boolean
    Determine if this object is valid.
    void
    Set this object to operate on Greenwich Mean (date and) time, which is the default.
    void
    Set this object to operate on local (date and) time as opposed to the default, which is Greenwich Mean (date and) time.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • XFA_DATETIME_FMT1

      public static final String XFA_DATETIME_FMT1
      An ISO8601/XFA date time pattern string: YYYYMMDDTHHMMSS.FFFz.
      See Also:
    • XFA_DATETIME_FMT2

      public static final String XFA_DATETIME_FMT2
      An alternate ISO8601/XFA date time pattern string: YYYY-MM-DDTHH:MM:SS.FFFzz.
      See Also:
  • Constructor Details

    • ISODateTime

      public ISODateTime()
      Instantiate an ISODateTime object from today's date and time.
    • ISODateTime

      public ISODateTime(String datetime, String datelocale, String timelocale)
      Instantiate an ISODateTime object from the given date time string.
      Parameters:
      datetime - an ISO8601/XFA date time string.
      datelocale - a date locale name.
      timelocale - a time locale name.
  • Method Details

    • setLocalTime

      public void setLocalTime()
      Set this object to operate on local (date and) time as opposed to the default, which is Greenwich Mean (date and) time. Any subsequent calls to the format method will result in date time strings that are expressed in local time.
    • setGMTime

      public void setGMTime()
      Set this object to operate on Greenwich Mean (date and) time, which is the default. Any subsequent calls to the format method will result in date time strings that are expressed in Greenwich Mean time.
    • format

      public String format(String isoformat)
      Format this object given the ISO datetime format string.
      Parameters:
      isoformat - an ISO8601/XFA date time format string.
      Returns:
      the date time string formatted according to the given format string, upon success, or the empty string, upon error.
    • isValid

      public boolean isValid()
      Determine if this object is valid.
      Returns:
      boolean true if valid, and false otherwise.
    • getDate

      public ISODate getDate()
      Get date component of this object
      Returns:
      date
    • getTime

      public ISOTime getTime()
      Get time component of this object
      Returns:
      time