public class PRDateFormat extends PerThreadCache
See http://oss.software.ibm.com/cgi-bin/icu/lx for an page that permits one to explore the settings supplied for each locale.
Modifier and Type | Field and Description |
---|---|
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_GREGORIAN_1
new locale-specific short date format
|
static java.lang.String |
DEFAULT_DATE_GREGORIAN_2
new locale-specific medium date format
|
static java.lang.String |
DEFAULT_DATE_GREGORIAN_3
new locale-specific long date format
|
static java.lang.String |
DEFAULT_DATE_ISO_8601
new locale-specific default 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_GREGORIAN_1
12hr locale-specific short date format
|
static java.lang.String |
DEFAULT_DATETIME_GREGORIAN_2
12hr locale-specific medium date format
|
static java.lang.String |
DEFAULT_DATETIME_GREGORIAN_3
12hr locale-specific long date format
|
static java.lang.String |
DEFAULT_DATETIME_ISO_8601
12hr locale-specific default date 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 java.lang.String[] |
SPECIAL_DATE_PATTERNS
This is an array of date patterns which are unique.
|
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
|
USE_DEFAULT_TIMEZONE, USE_DEFAULT_TIMEZONE_PRE42SP6
Modifier and Type | Method and Description |
---|---|
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[] |
getShortMonths(java.lang.String aLocale)
Returns Locale specific Short form of months names.
|
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 boolean |
isOnlyDateEnteredInDateTimeDataType(java.lang.String aValue,
java.lang.String aLocale,
java.lang.String aZone)
Returns true if the value specified doesn't contain time part.
|
static void |
main(java.lang.String[] args) |
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 |
parseAsDate(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue,
boolean parseOnlyIfDate)
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) |
static java.util.Date |
parseIfDate(java.lang.String aLocale,
java.lang.String aZone,
java.lang.String[] aPatterns,
java.lang.String aValue,
boolean parseOnlyIfDate)
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 long |
parseInternalLocalDatetoLong(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 |
parseISO8601Date(java.lang.String aValue)
Parse an ISO8601 date value to a java.util.Date
|
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
|
getDefaultTimeZone, getLocale, getLocaleName, getTimeZone, setDefaultTimeZone
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[] SPECIAL_DATE_PATTERNS
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 java.lang.String DEFAULT_DATETIME_ISO_8601
public static final java.lang.String DEFAULT_DATETIME_GREGORIAN_1
public static final java.lang.String DEFAULT_DATETIME_GREGORIAN_2
public static final java.lang.String DEFAULT_DATETIME_GREGORIAN_3
public static final java.lang.String DEFAULT_DATE_ISO_8601
public static final java.lang.String DEFAULT_DATE_GREGORIAN_1
public static final java.lang.String DEFAULT_DATE_GREGORIAN_2
public static final java.lang.String DEFAULT_DATE_GREGORIAN_3
public static final int SUNDAY
DAY_OF_WEEK
field indicating
Sunday.public static final int MONDAY
DAY_OF_WEEK
field indicating
Monday.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 convertpublic 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 Datenull
if the String could not be convertedpublic static final java.util.Date parseHTTPDateTime(java.lang.String aValue)
aValue
- formatted value to convert to Datenull
if the String could not be convertedpublic static final java.lang.String formatInternalDateTime(java.util.Date aValue)
aValue
- Date to be formatted as DateTimepublic static final java.lang.String formatIDT(long millis)
millis
- count of milliseconds to be formatted as DateTimepublic static final java.lang.String formatInternalDate(java.util.Date aValue)
aValue
- Date to be formatted as Datepublic static final java.lang.String formatInternalTime(java.util.Date aValue)
aValue
- Date to be formatted as Timepublic static final java.lang.String formatXSDDateTime(java.util.Date aValue)
aValue
- Date to be formatted as XSD dateTimepublic 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 usedpublic static final java.lang.String formatXSDDate(java.util.Date aValue)
aValue
- Date to be formatted as XSD datepublic 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 usedpublic static final java.lang.String formatXSDTime(java.util.Date aValue)
aValue
- Date to be formatted as XSD timepublic 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 usedpublic static final java.util.Date parseInternalDateTime(java.lang.String aValue)
aValue
- String to be parsed as DateTimepublic static final long parseIDTtoLong(java.lang.String aValue)
public static final long parseInternalDatetoLong(java.lang.String aValue)
public static final long parseInternalLocalDatetoLong(java.lang.String aValue)
public static final java.util.Date parseInternalDate(java.lang.String aValue)
aValue
- String to be parsed as DateaValue
, in the GMT time zonepublic static final java.util.Date parseInternalTime(java.lang.String aValue)
aValue
- String to be parsed as Timepublic static final java.util.Date parseXSDDateTime(java.lang.String aValue)
aValue
- String to be parsed as XSD dateTimepublic static final java.util.Date parseISO8601Date(java.lang.String aValue)
aValue
- String to be parsed as ISO8601 Datepublic static final java.util.Date parseXSDDate(java.lang.String aValue)
aValue
- String to be parsed as XSD datepublic static final java.util.Date parseXSDTime(java.lang.String aValue)
aValue
- String to be parsed as XSD timepublic 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 parseInvalidValueException
- 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 parsepublic 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 parseInvalidValueException
- if could not be parsedpublic static final java.util.Date parseAsDate(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue, boolean parseOnlyIfDate)
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 parseparseOnlyIfDate
- if false then parses DateTime literal into Date otherwise not.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)
public static final java.util.Date parseIfDate(java.lang.String aLocale, java.lang.String aZone, java.lang.String[] aPatterns, java.lang.String aValue, boolean parseOnlyIfDate)
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 parseparseOnlyIfDate
- if true parses the value only if its a date. else attempts to convert the value to Date.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 parseInvalidValueException
- 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 parsepublic static final double toDoubleAsDateTime(java.util.Date aDate)
aDate
- value to convertpublic static final double toDoubleAsDate(java.util.Date aDate)
aDate
- value to convertpublic static final double toDoubleAsDateOnly(double aDate)
aDate
- double to strip to dayspublic static final double toDoubleAsTime(java.util.Date aDate)
aDate
- value to convertpublic static final double toDoubleAsTimeOnly(double aDate)
aDate
- double to strip to timepublic static final java.util.Date toDateAsDateTime(double aDate)
aDate
- double value to convertpublic static final java.util.Date toDateAsDateOnly(double aDate)
aDate
- double value to convertpublic static final java.util.Date toDateAsTimeOnly(double aDate)
aDate
- double value to convertpublic static final java.lang.String[] getMonths(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static final java.lang.String[] getShortMonths(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static final java.lang.String[] getWeekdays(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static final java.lang.String[] getShortWeekdays(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static int getFirstWeekDay(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static java.util.Locale[] getLocalizedNames(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static java.lang.String getShortDateFormat(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static java.lang.String[] getAmPmStrings(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic static java.lang.String getShortDateTimeFormat(java.lang.String aLocale)
aLocale
- locale name, if null or blank, the default locale is usedpublic 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 formatpublic 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 formatpublic static void main(java.lang.String[] args)
public static boolean isOnlyDateEnteredInDateTimeDataType(java.lang.String aValue, java.lang.String aLocale, java.lang.String aZone)
aValue
- aLocale
- aZone
- Copyright © 2018 Pegasystems Inc. All Rights Reserved.