Package de.uplanet.util
Class DateParser
- java.lang.Object
-
- de.uplanet.util.DateParser
-
@Scriptable public final class DateParser extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
UTC_ISO_DATE_TIME_FORMAT
yyyy-MM-dd'T'HH:mm:ss'Z'
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Date
parseDate(String p_strValue)
Parse a string as an UTC date, or as a date with time zone offset.static Date
parseDate(String p_strValue, String p_strFormat, TimeZone p_tz)
Parse a string as a date, using the given format, time zone, and theLocale.US
locale.
-
-
-
Field Detail
-
UTC_ISO_DATE_TIME_FORMAT
public static final String UTC_ISO_DATE_TIME_FORMAT
yyyy-MM-dd'T'HH:mm:ss'Z'
.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseDate
public static final Date parseDate(String p_strValue, String p_strFormat, TimeZone p_tz)
Parse a string as a date, using the given format, time zone, and theLocale.US
locale.- Parameters:
p_strValue
- The serialized date-time value.p_strFormat
- The format used for parsing.p_tz
- The timezone to be used for parsing.- Returns:
- The parsed date.
- Throws:
IllegalArgumentException
- If any of the given parameters isnull
.
-
parseDate
public static final Date parseDate(String p_strValue) throws ParseException
Parse a string as an UTC date, or as a date with time zone offset.Valid formats are
yyyy-MM-dd'T'HH:mm:ss'Z'
(UTC)yyyy-MM-dd'T'HH:mm:ssZ
(with RFC 822 time zone offset)
SimpleDateFormat
.- Parameters:
p_strValue
- The serialized date-time value.- Returns:
- The parsed date.
- Throws:
ParseException
- If the given string could not be parsed as a date-time value.IllegalArgumentException
- If p_strValue isnull
.
-
-