Package com.adobe.xfa.ut
Class ISODateTime
- java.lang.Object
-
- com.adobe.xfa.ut.ISODateTime
-
public class ISODateTime extends Object
The class ISODateTime is a convenience class grouping theISODate
andISOTime
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
andISOTime
for the definitions of valid ISO8601/XFA date and time patterns. Here's a snippet of code illustrating the use ofISODateTime
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 String
XFA_DATETIME_FMT1
An ISO8601/XFA date time pattern string: YYYYMMDDTHHMMSS.FFFz.static String
XFA_DATETIME_FMT2
An alternate ISO8601/XFA date time pattern string: YYYY-MM-DDTHH:MM:SS.FFFzz.
-
Constructor Summary
Constructors Constructor Description ISODateTime()
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(String isoformat)
Format this object given the ISO datetime format string.ISODate
getDate()
Get date component of this objectISOTime
getTime()
Get time component of this objectboolean
isValid()
Determine if this object is valid.void
setGMTime()
Set this object to operate on Greenwich Mean (date and) time, which is the default.void
setLocalTime()
Set this object to operate on local (date and) time as opposed to the default, which is Greenwich Mean (date and) time.
-
-
-
Field Detail
-
XFA_DATETIME_FMT1
public static final String XFA_DATETIME_FMT1
An ISO8601/XFA date time pattern string: YYYYMMDDTHHMMSS.FFFz.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
-
Method Detail
-
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
-
-