|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pega.pegarules.pub.util.PerThreadCache
com.pega.pegarules.pub.util.PRDateFormat
public class PRDateFormat
PRDateFormat wraps the ICU date and time formatting support with a thread-safe implementation geared to PegaRULES conventions.
See http://oss.software.ibm.com/cgi-bin/icu/lx for an page that permits one to explore the settings supplied for each locale.
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT
|
static java.lang.String |
DEFAULT_DATE_DEFAULT
locale-specific default date format |
static java.lang.String |
DEFAULT_DATE_FULL
locale-specific full date format |
static java.lang.String |
DEFAULT_DATE_LONG
locale-specific long date format |
static java.lang.String |
DEFAULT_DATE_MEDIUM
locale-specific medium date format |
static java.lang.String |
DEFAULT_DATE_SHORT
locale-specific short date format |
static java.lang.String |
DEFAULT_DATE_SHORT_YY
locale-specific short date format with 2 digit year |
static java.lang.String |
DEFAULT_DATE_SHORT_YYYY
locale-specific short date format with 4 digit year |
static java.lang.String |
DEFAULT_DATETIME_DEFAULT
locale-specific default datetime format |
static java.lang.String |
DEFAULT_DATETIME_FULL
locale-specific full datetime format |
static java.lang.String |
DEFAULT_DATETIME_LONG
locale-specific long datetime format |
static java.lang.String |
DEFAULT_DATETIME_MEDIUM
locale-specific medium datetime format |
static java.lang.String |
DEFAULT_DATETIME_SHORT
locale-specific short datetime format |
static java.lang.String |
DEFAULT_DATETIME_SHORT_YY
locale-specific short datetime format with 2 digit year |
static java.lang.String |
DEFAULT_DATETIME_SHORT_YYYY
locale-specific short datetime format with 4 digit year |
static java.lang.String |
DEFAULT_TIME_DEFAULT
locale-specific default time format |
static java.lang.String |
DEFAULT_TIME_FULL
locale-specific full time format |
static java.lang.String |
DEFAULT_TIME_LONG
locale-specific long time format |
static java.lang.String |
DEFAULT_TIME_MEDIUM
locale-specific medium time format |
static java.lang.String |
DEFAULT_TIME_SHORT
locale-specific short time format |
static int |
MONDAY
Value of the DAY_OF_WEEK field indicating
Monday. |
static java.lang.String |
PEGARULES_INTERNAL_DATE
internal PegaRULES format for Date properties |
static java.lang.String |
PEGARULES_INTERNAL_DATETIME
internal PegaRULES format for DateTime properties |
static java.lang.String |
PEGARULES_INTERNAL_DATETIME_LEGACY
internal PegaRULES format for DateTime properties (v2 format) |
static java.lang.String |
PEGARULES_INTERNAL_TIME
internal PegaRULES format for TimeOfDay properties |
static int |
SUNDAY
Value of the DAY_OF_WEEK field indicating
Sunday. |
static java.lang.String |
VERSION
|
static java.lang.String |
XML_SCHEMA_DATE
XML Schema format for date values |
static java.lang.String |
XML_SCHEMA_DATETIME
XML Schema format for dateTime values |
static java.lang.String |
XML_SCHEMA_DATETIME_FULL
XML Schema format for dateTime values with ms and UTC timezone symbol |
static java.lang.String |
XML_SCHEMA_TIME
XML Schema format for time values |
static java.lang.String |
XML_SCHEMA_TIME_FULL
XML Schema format for time values with ms and UTC timezone symbol |
Fields inherited from class com.pega.pegarules.pub.util.PerThreadCache |
---|
USE_DEFAULT_TIMEZONE, USE_DEFAULT_TIMEZONE_PRE42SP6 |
Method Summary | |
---|---|
static java.lang.String |
format(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String aPattern,
java.util.Date aDate)
Formats the datetime using the specified pattern, locale and timezone. |
static java.lang.String |
formatIDT(long millis)
convenience method to format PegaRULES DateTime values |
static java.lang.String |
formatInternalDate(java.util.Date aValue)
convenience method to format PegaRULES Date values |
static java.lang.String |
formatInternalDateTime(java.util.Date aValue)
convenience method to format PegaRULES DateTime values |
static java.lang.String |
formatInternalTime(java.util.Date aValue)
convenience method to format PegaRULES TimeOfDay values |
static java.lang.String |
formatXSDDate(java.util.Date aValue)
Formats a java.util.Date as an XML Schema date value |
static java.lang.String |
formatXSDDate(java.util.Date aValue,
java.lang.String aZone)
Formats a java.util.Date as an XML Schema date value |
static java.lang.String |
formatXSDDateTime(java.util.Date aValue)
Formats a java.util.Date as an XML Schema dateTime value |
static java.lang.String |
formatXSDDateTime(java.util.Date aValue,
java.lang.String aZone)
Formats a java.util.Date as an XML Schema dateTime value |
static java.lang.String |
formatXSDTime(java.util.Date aValue)
Formats a java.util.Date as an XML Schema time value |
static java.lang.String |
formatXSDTime(java.util.Date aValue,
java.lang.String aZone)
Formats a java.util.Date as an XML Schema time value |
static java.lang.String[] |
getAmPmStrings(java.lang.String aLocale)
Returns Am Pm Strings |
static int |
getFirstWeekDay(java.lang.String aLocale)
Returns first day of the week |
static com.pega.ibm.icu.text.DateFormat |
getFormat(java.lang.String aLocale,
java.lang.String aPattern)
Returns the per-Thread cached DateFormat instance corresponding to the specified pattern or PRDateFormat name for the specified locale. |
static java.lang.String |
getFormatPattern(java.lang.String aLocale,
java.lang.String aPattern)
Returns the (non-localized) pattern corresponding to the specified pattern or PRDateFormat name for the specified locale. |
static java.util.Locale[] |
getLocalizedNames(java.lang.String aLocale)
Returns array of Locales sorted by locale specific display names |
static java.lang.String[] |
getMonths(java.lang.String aLocale)
Returns Locale specific full months names. |
static java.lang.String |
getShortDateFormat(java.lang.String aLocale)
Returns the modified SHORT date format with a 4-digit year for a locale |
static java.lang.String |
getShortDateTimeFormat(java.lang.String aLocale)
Returns the modified SHORT date time format with a 4-digit year for a locale |
static java.lang.String[] |
getShortWeekdays(java.lang.String aLocale)
Returns Locale specific short week names. |
static java.lang.String[] |
getWeekdays(java.lang.String aLocale)
Returns Locale specific full weekday names. |
static java.util.Date |
parse(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String aPattern,
java.lang.String aString)
Parses the String using the specified pattern, locale and timezone as a DateTime. |
static java.util.Date |
parseAsDate(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue)
convenience method to parse a String as a date, trying a list of patterns in an attempt to guess the correct format. |
static java.util.Date |
parseAsDateTime(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue)
convenience method to parse a String as a DateTime, trying a list of patterns in an attempt to guess the correct format. |
static java.util.Date |
parseAsTime(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue)
convenience method to parse a String as a time, trying a list of patterns in an attempt to guess the correct format. |
static java.util.Date |
parseHTTPDateTime(java.lang.String aValue)
Parses the String as if it were an Date/Time format following RFC 2068, Section 3.3.1 |
static long |
parseIDTtoLong(java.lang.String aValue)
|
static java.util.Date |
parseIfDate(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue)
convenience method to parse a String as a date, trying a list of patterns in an attempt to guess the correct format. |
static java.util.Date |
parseIfDateTime(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue)
convenience method to parse a String as a DateTime, trying a list of patterns in an attempt to guess the correct format. |
static java.util.Date |
parseIfTime(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue)
convenience method to parse a String as a time, trying a list of patterns in an attempt to guess the correct format. |
static java.util.Date |
parseInternalDate(java.lang.String aValue)
convenience method to parse standard PegaRULES Date values |
static java.util.Date |
parseInternalDateTime(java.lang.String aValue)
convenience method to parse standard PegaRULES DateTime values |
static long |
parseInternalDatetoLong(java.lang.String aValue)
|
static java.util.Date |
parseInternalTime(java.lang.String aValue)
convenience method to parse standard PegaRULES TimeOfDay values |
static java.util.Date |
parseXSDDate(java.lang.String aValue)
Parse an XML Schema date value to a java.util.Date |
static java.util.Date |
parseXSDDateTime(java.lang.String aValue)
Parse an XML Schema dateTime value to a java.util.Date |
static java.util.Date |
parseXSDTime(java.lang.String aValue)
Parse an XML Schema time value to a java.util.Date |
static java.util.Date |
toDateAsDateOnly(double aDate)
convience function to convert a double to a Date with only the date component retained |
static java.util.Date |
toDateAsDateTime(double aDate)
convience function to convert a double to a Date with both date and time components retained |
static java.util.Date |
toDateAsTimeOnly(double aDate)
convience function to convert a double to a Date with only the time component retained |
static double |
toDoubleAsDate(java.util.Date aDate)
Convert a Java Date to double, treating value as a Date with a zero time component |
static double |
toDoubleAsDateOnly(double aDate)
convenience function to pick out only the Date portion of a double leaving it with a zero time component. |
static double |
toDoubleAsDateTime(java.util.Date aDate)
Convert a Java Date to double, treating value as a DateTime |
static double |
toDoubleAsTime(java.util.Date aDate)
Convert a Java Date to double, treating value as a Time with a zero date component |
static double |
toDoubleAsTimeOnly(double aDate)
convenience function to pick out only the Time portion of a double leaving it with a zero date component |
Methods inherited from class com.pega.pegarules.pub.util.PerThreadCache |
---|
getDefaultTimeZone, getLocale, getLocaleName, getTimeZone, setDefaultTimeZone |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
public static final java.lang.String DEFAULT_DATE_DEFAULT
public static final java.lang.String DEFAULT_DATE_SHORT
public static final java.lang.String DEFAULT_DATE_MEDIUM
public static final java.lang.String DEFAULT_DATE_LONG
public static final java.lang.String DEFAULT_DATE_FULL
public static final java.lang.String DEFAULT_DATE_SHORT_YYYY
public static final java.lang.String DEFAULT_DATE_SHORT_YY
public static final java.lang.String DEFAULT_TIME_DEFAULT
public static final java.lang.String DEFAULT_TIME_SHORT
public static final java.lang.String DEFAULT_TIME_MEDIUM
public static final java.lang.String DEFAULT_TIME_LONG
public static final java.lang.String DEFAULT_TIME_FULL
public static final java.lang.String DEFAULT_DATETIME_DEFAULT
public static final java.lang.String DEFAULT_DATETIME_SHORT
public static final java.lang.String DEFAULT_DATETIME_MEDIUM
public static final java.lang.String DEFAULT_DATETIME_LONG
public static final java.lang.String DEFAULT_DATETIME_FULL
public static final java.lang.String DEFAULT_DATETIME_SHORT_YYYY
public static final java.lang.String DEFAULT_DATETIME_SHORT_YY
public static final java.lang.String PEGARULES_INTERNAL_DATETIME
public static final java.lang.String PEGARULES_INTERNAL_DATETIME_LEGACY
public static final java.lang.String PEGARULES_INTERNAL_DATE
public static final java.lang.String PEGARULES_INTERNAL_TIME
public static final java.lang.String XML_SCHEMA_DATETIME
public static final java.lang.String XML_SCHEMA_DATETIME_FULL
public static final java.lang.String XML_SCHEMA_DATE
public static final java.lang.String XML_SCHEMA_TIME
public static final java.lang.String XML_SCHEMA_TIME_FULL
public static final int SUNDAY
DAY_OF_WEEK
field indicating
Sunday.
public static final int MONDAY
DAY_OF_WEEK
field indicating
Monday.
Method Detail |
---|
public static final java.lang.String format(java.lang.String aLocale, java.lang.String aZone, java.lang.String aPattern, java.util.Date aDate)
aLocale
- locale name, if null or blank, the default locale is usedaZone
- time zone name, if null or blank, the default zone is usedaPattern
- format patternaDate
- date to convert
public static final java.util.Date parse(java.lang.String aLocale, java.lang.String aZone, java.lang.String aPattern, java.lang.String aString)
aLocale
- locale name, if null or blank, the default locale is usedaZone
- time zone name, if null or blank, the default zone is usedaPattern
- format patternaString
- formatted value to convert to Date
null
if the String could not be convertedpublic static final java.util.Date parseHTTPDateTime(java.lang.String aValue)
aValue
- formatted value to convert to Date
null
if the String could not be convertedpublic static final java.lang.String formatInternalDateTime(java.util.Date aValue)
aValue
- Date to be formatted as DateTime
public static final java.lang.String formatIDT(long millis)
millis
- count of milliseconds to be formatted as DateTime
public static final java.lang.String formatInternalDate(java.util.Date aValue)
aValue
- Date to be formatted as Date
public static final java.lang.String formatInternalTime(java.util.Date aValue)
aValue
- Date to be formatted as Time
public static final java.lang.String formatXSDDateTime(java.util.Date aValue)
aValue
- Date to be formatted as XSD dateTime
public static final java.lang.String formatXSDDateTime(java.util.Date aValue, java.lang.String aZone)
aValue
- Date to be formatted as XSD dateTimeaZone
- time zone name, if null or blank, the default zone is used
public static final java.lang.String formatXSDDate(java.util.Date aValue)
aValue
- Date to be formatted as XSD date
public static final java.lang.String formatXSDDate(java.util.Date aValue, java.lang.String aZone)
aValue
- Date to be formatted as XSD dateaZone
- time zone name, if null or blank, the default zone is used
public static final java.lang.String formatXSDTime(java.util.Date aValue)
aValue
- Date to be formatted as XSD time
public static final java.lang.String formatXSDTime(java.util.Date aValue, java.lang.String aZone)
aValue
- Date to be formatted as XSD timeaZone
- time zone name, if null or blank, the default zone is used
public static final java.util.Date parseInternalDateTime(java.lang.String aValue)
aValue
- String to be parsed as DateTime
public static final long parseIDTtoLong(java.lang.String aValue)
public static final long parseInternalDatetoLong(java.lang.String aValue)
public static final java.util.Date parseInternalDate(java.lang.String aValue)
aValue
- String to be parsed as Date
aValue
, in the GMT time zonepublic static final java.util.Date parseInternalTime(java.lang.String aValue)
aValue
- String to be parsed as Time
public static final java.util.Date parseXSDDateTime(java.lang.String aValue)
aValue
- String to be parsed as XSD dateTime
public static final java.util.Date parseXSDDate(java.lang.String aValue)
aValue
- String to be parsed as XSD date
public static final java.util.Date parseXSDTime(java.lang.String aValue)
aValue
- String to be parsed as XSD time
public static final java.util.Date parseAsDateTime(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue)
aLocale
- locale to useaZone
- time zone to defaultaPatterns
- array of patterns, if null or empty, a default list will be usedaValue
- String to parse
InvalidValueException
- if could not be parsedpublic static final java.util.Date parseIfDateTime(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue)
aLocale
- locale to useaZone
- time zone to defaultaPatterns
- array of patterns, if null or empty, a default list will be usedaValue
- String to parse
public static final java.util.Date parseAsDate(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue)
aLocale
- locale to useaZone
- time zone to use, if null or empty, GMT will be used for consistency
with standard PegaRULES date and to avoid introducing a "time" component into a date. If
an explicit time zone is specified, the resulting Date object will hold the GMT equivalent
date/time of midnight in the given timezone on the specified date.aPatterns
- array of patterns, if null or empty, a default list will be usedaValue
- String to parse
InvalidValueException
- if could not be parsedpublic static final java.util.Date parseIfDate(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue)
aLocale
- locale to useaZone
- time zone to use, if null or empty, GMT will be used for consistency
with standard PegaRULES date and to avoid introducing a "time" component into a date. If
an explicit time zone is specified, the resulting Date object will hold the GMT equivalent
date/time of midnight in the given timezone on the specified date.aPatterns
- array of patterns, if null or empty, a default list will be usedaValue
- String to parse
public static final java.util.Date parseAsTime(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue)
aLocale
- locale to useaZone
- time zone to use, if null or empty, GMT will be used for consistency
with standard PegaRULES time and to avoid introducing a "date" component into a date. If
an explicit time zone is specified, the resulting Date object will hold the GMT equivalent
date/time of the specified time in the given timezone on date Jan 1, 1970 (the epoch).aPatterns
- array of patterns, if null or empty, a default list will be usedaValue
- String to parse
InvalidValueException
- if could not be parsedpublic static final java.util.Date parseIfTime(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue)
aLocale
- locale to useaZone
- time zone to use, if null or empty, GMT will be used for consistency
with standard PegaRULES time and to avoid introducing a "date" component into a date. If
an explicit time zone is specified, the resulting Date object will hold the GMT equivalent
date/time of the specified time in the given timezone on date Jan 1, 1970 (the epoch).aPatterns
- array of patterns, if null or empty, a default list will be usedaValue
- String to parse
public static final double toDoubleAsDateTime(java.util.Date aDate)
aDate
- value to convert
public static final double toDoubleAsDate(java.util.Date aDate)
aDate
- value to convert
public static final double toDoubleAsDateOnly(double aDate)
aDate
- double to strip to days
public static final double toDoubleAsTime(java.util.Date aDate)
aDate
- value to convert
public static final double toDoubleAsTimeOnly(double aDate)
aDate
- double to strip to time
public static final java.util.Date toDateAsDateTime(double aDate)
aDate
- double value to convert
public static final java.util.Date toDateAsDateOnly(double aDate)
aDate
- double value to convert
public static final java.util.Date toDateAsTimeOnly(double aDate)
aDate
- double value to convert
public static final java.lang.String[] getMonths(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static final java.lang.String[] getWeekdays(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static final java.lang.String[] getShortWeekdays(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static int getFirstWeekDay(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static java.util.Locale[] getLocalizedNames(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static java.lang.String getShortDateFormat(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static java.lang.String[] getAmPmStrings(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static java.lang.String getShortDateTimeFormat(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is used
public static final com.pega.ibm.icu.text.DateFormat getFormat(java.lang.String aLocale, java.lang.String aPattern)
aLocale
- locale name, if null or blank the default locale is usedaPattern
- pattern or name for the format
public static final java.lang.String getFormatPattern(java.lang.String aLocale, java.lang.String aPattern)
aLocale
- locale name, if null or blank the default locale is usedaPattern
- pattern or name for the format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |