com.pega.pegarules.pub.util
Class PRDateFormat

java.lang.Object
  extended by com.pega.pegarules.pub.util.PerThreadCache
      extended by com.pega.pegarules.pub.util.PRDateFormat

public class PRDateFormat
extends PerThreadCache

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.

Version:
$Revision: 35547 $ $Date: 2012-09-28 14:00:09 -0400 (Fri, 28 Sep 2012) $
Author:
olsok

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

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION

DEFAULT_DATE_DEFAULT

public static final java.lang.String DEFAULT_DATE_DEFAULT
locale-specific default date format

See Also:
Constant Field Values

DEFAULT_DATE_SHORT

public static final java.lang.String DEFAULT_DATE_SHORT
locale-specific short date format

See Also:
Constant Field Values

DEFAULT_DATE_MEDIUM

public static final java.lang.String DEFAULT_DATE_MEDIUM
locale-specific medium date format

See Also:
Constant Field Values

DEFAULT_DATE_LONG

public static final java.lang.String DEFAULT_DATE_LONG
locale-specific long date format

See Also:
Constant Field Values

DEFAULT_DATE_FULL

public static final java.lang.String DEFAULT_DATE_FULL
locale-specific full date format

See Also:
Constant Field Values

DEFAULT_DATE_SHORT_YYYY

public static final java.lang.String DEFAULT_DATE_SHORT_YYYY
locale-specific short date format with 4 digit year

See Also:
Constant Field Values

DEFAULT_DATE_SHORT_YY

public static final java.lang.String DEFAULT_DATE_SHORT_YY
locale-specific short date format with 2 digit year

See Also:
Constant Field Values

DEFAULT_TIME_DEFAULT

public static final java.lang.String DEFAULT_TIME_DEFAULT
locale-specific default time format

See Also:
Constant Field Values

DEFAULT_TIME_SHORT

public static final java.lang.String DEFAULT_TIME_SHORT
locale-specific short time format

See Also:
Constant Field Values

DEFAULT_TIME_MEDIUM

public static final java.lang.String DEFAULT_TIME_MEDIUM
locale-specific medium time format

See Also:
Constant Field Values

DEFAULT_TIME_LONG

public static final java.lang.String DEFAULT_TIME_LONG
locale-specific long time format

See Also:
Constant Field Values

DEFAULT_TIME_FULL

public static final java.lang.String DEFAULT_TIME_FULL
locale-specific full time format

See Also:
Constant Field Values

DEFAULT_DATETIME_DEFAULT

public static final java.lang.String DEFAULT_DATETIME_DEFAULT
locale-specific default datetime format

See Also:
Constant Field Values

DEFAULT_DATETIME_SHORT

public static final java.lang.String DEFAULT_DATETIME_SHORT
locale-specific short datetime format

See Also:
Constant Field Values

DEFAULT_DATETIME_MEDIUM

public static final java.lang.String DEFAULT_DATETIME_MEDIUM
locale-specific medium datetime format

See Also:
Constant Field Values

DEFAULT_DATETIME_LONG

public static final java.lang.String DEFAULT_DATETIME_LONG
locale-specific long datetime format

See Also:
Constant Field Values

DEFAULT_DATETIME_FULL

public static final java.lang.String DEFAULT_DATETIME_FULL
locale-specific full datetime format

See Also:
Constant Field Values

DEFAULT_DATETIME_SHORT_YYYY

public static final java.lang.String DEFAULT_DATETIME_SHORT_YYYY
locale-specific short datetime format with 4 digit year

See Also:
Constant Field Values

DEFAULT_DATETIME_SHORT_YY

public static final java.lang.String DEFAULT_DATETIME_SHORT_YY
locale-specific short datetime format with 2 digit year

See Also:
Constant Field Values

PEGARULES_INTERNAL_DATETIME

public static final java.lang.String PEGARULES_INTERNAL_DATETIME
internal PegaRULES format for DateTime properties

See Also:
Constant Field Values

PEGARULES_INTERNAL_DATETIME_LEGACY

public static final java.lang.String PEGARULES_INTERNAL_DATETIME_LEGACY
internal PegaRULES format for DateTime properties (v2 format)

See Also:
Constant Field Values

PEGARULES_INTERNAL_DATE

public static final java.lang.String PEGARULES_INTERNAL_DATE
internal PegaRULES format for Date properties

See Also:
Constant Field Values

PEGARULES_INTERNAL_TIME

public static final java.lang.String PEGARULES_INTERNAL_TIME
internal PegaRULES format for TimeOfDay properties

See Also:
Constant Field Values

XML_SCHEMA_DATETIME

public static final java.lang.String XML_SCHEMA_DATETIME
XML Schema format for dateTime values

See Also:
Constant Field Values

XML_SCHEMA_DATETIME_FULL

public static final java.lang.String XML_SCHEMA_DATETIME_FULL
XML Schema format for dateTime values with ms and UTC timezone symbol

See Also:
Constant Field Values

XML_SCHEMA_DATE

public static final java.lang.String XML_SCHEMA_DATE
XML Schema format for date values

See Also:
Constant Field Values

XML_SCHEMA_TIME

public static final java.lang.String XML_SCHEMA_TIME
XML Schema format for time values

See Also:
Constant Field Values

XML_SCHEMA_TIME_FULL

public static final java.lang.String XML_SCHEMA_TIME_FULL
XML Schema format for time values with ms and UTC timezone symbol

See Also:
Constant Field Values

SUNDAY

public static final int SUNDAY
Value of the DAY_OF_WEEK field indicating Sunday.

See Also:
Constant Field Values

MONDAY

public static final int MONDAY
Value of the DAY_OF_WEEK field indicating Monday.

See Also:
Constant Field Values
Method Detail

format

public static final 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.

Parameters:
aLocale - locale name, if null or blank, the default locale is used
aZone - time zone name, if null or blank, the default zone is used
aPattern - format pattern
aDate - date to convert
Returns:
formatted value

parse

public static final 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.

Parameters:
aLocale - locale name, if null or blank, the default locale is used
aZone - time zone name, if null or blank, the default zone is used
aPattern - format pattern
aString - formatted value to convert to Date
Returns:
Date value or null if the String could not be converted

parseHTTPDateTime

public static final 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

Parameters:
aValue - formatted value to convert to Date
Returns:
Date value or null if the String could not be converted

formatInternalDateTime

public static final java.lang.String formatInternalDateTime(java.util.Date aValue)
convenience method to format PegaRULES DateTime values

Parameters:
aValue - Date to be formatted as DateTime
Returns:
formatted value

formatIDT

public static final java.lang.String formatIDT(long millis)
convenience method to format PegaRULES DateTime values

Parameters:
millis - count of milliseconds to be formatted as DateTime
Returns:
formatted value

formatInternalDate

public static final java.lang.String formatInternalDate(java.util.Date aValue)
convenience method to format PegaRULES Date values

Parameters:
aValue - Date to be formatted as Date
Returns:
formatted value

formatInternalTime

public static final java.lang.String formatInternalTime(java.util.Date aValue)
convenience method to format PegaRULES TimeOfDay values

Parameters:
aValue - Date to be formatted as Time
Returns:
formatted value

formatXSDDateTime

public static final java.lang.String formatXSDDateTime(java.util.Date aValue)
Formats a java.util.Date as an XML Schema dateTime value

Parameters:
aValue - Date to be formatted as XSD dateTime
Returns:
formatted value

formatXSDDateTime

public static final java.lang.String formatXSDDateTime(java.util.Date aValue,
                                                       java.lang.String aZone)
Formats a java.util.Date as an XML Schema dateTime value

Parameters:
aValue - Date to be formatted as XSD dateTime
aZone - time zone name, if null or blank, the default zone is used
Returns:
formatted value

formatXSDDate

public static final java.lang.String formatXSDDate(java.util.Date aValue)
Formats a java.util.Date as an XML Schema date value

Parameters:
aValue - Date to be formatted as XSD date
Returns:
formatted value

formatXSDDate

public static final java.lang.String formatXSDDate(java.util.Date aValue,
                                                   java.lang.String aZone)
Formats a java.util.Date as an XML Schema date value

Parameters:
aValue - Date to be formatted as XSD date
aZone - time zone name, if null or blank, the default zone is used
Returns:
formatted value

formatXSDTime

public static final java.lang.String formatXSDTime(java.util.Date aValue)
Formats a java.util.Date as an XML Schema time value

Parameters:
aValue - Date to be formatted as XSD time
Returns:
formatted value

formatXSDTime

public static final java.lang.String formatXSDTime(java.util.Date aValue,
                                                   java.lang.String aZone)
Formats a java.util.Date as an XML Schema time value

Parameters:
aValue - Date to be formatted as XSD time
aZone - time zone name, if null or blank, the default zone is used
Returns:
formatted value

parseInternalDateTime

public static final java.util.Date parseInternalDateTime(java.lang.String aValue)
convenience method to parse standard PegaRULES DateTime values

Parameters:
aValue - String to be parsed as DateTime
Returns:
Date value

parseIDTtoLong

public static final long parseIDTtoLong(java.lang.String aValue)

parseInternalDatetoLong

public static final long parseInternalDatetoLong(java.lang.String aValue)

parseInternalDate

public static final java.util.Date parseInternalDate(java.lang.String aValue)
convenience method to parse standard PegaRULES Date values

Parameters:
aValue - String to be parsed as Date
Returns:
The date corresponding to midnight on the day specified by aValue, in the GMT time zone

parseInternalTime

public static final java.util.Date parseInternalTime(java.lang.String aValue)
convenience method to parse standard PegaRULES TimeOfDay values

Parameters:
aValue - String to be parsed as Time
Returns:
Date value

parseXSDDateTime

public static final java.util.Date parseXSDDateTime(java.lang.String aValue)
Parse an XML Schema dateTime value to a java.util.Date

Parameters:
aValue - String to be parsed as XSD dateTime
Returns:
Date value

parseXSDDate

public static final java.util.Date parseXSDDate(java.lang.String aValue)
Parse an XML Schema date value to a java.util.Date

Parameters:
aValue - String to be parsed as XSD date
Returns:
Date value

parseXSDTime

public static final java.util.Date parseXSDTime(java.lang.String aValue)
Parse an XML Schema time value to a java.util.Date

Parameters:
aValue - String to be parsed as XSD time
Returns:
Date value

parseAsDateTime

public static final 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.

Parameters:
aLocale - locale to use
aZone - time zone to default
aPatterns - array of patterns, if null or empty, a default list will be used
aValue - String to parse
Returns:
Date equivalent to the string.
Throws:
InvalidValueException - if could not be parsed

parseIfDateTime

public static final 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.

Parameters:
aLocale - locale to use
aZone - time zone to default
aPatterns - array of patterns, if null or empty, a default list will be used
aValue - String to parse
Returns:
Date equivalent to the string or null if the value pass was not a datetime.

parseAsDate

public static final 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.

Parameters:
aLocale - locale to use
aZone - 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 used
aValue - String to parse
Returns:
Date equivalent to the string.
Throws:
InvalidValueException - if could not be parsed

parseIfDate

public static final 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.

Parameters:
aLocale - locale to use
aZone - 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 used
aValue - String to parse
Returns:
Date equivalent to the string or null if this is not a date.

parseAsTime

public static final 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.

Parameters:
aLocale - locale to use
aZone - 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 used
aValue - String to parse
Returns:
Date equivalent to the string.
Throws:
InvalidValueException - if could not be parsed

parseIfTime

public static final 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.

Parameters:
aLocale - locale to use
aZone - 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 used
aValue - String to parse
Returns:
Date equivalent to the string.

toDoubleAsDateTime

public static final double toDoubleAsDateTime(java.util.Date aDate)
Convert a Java Date to double, treating value as a DateTime

Parameters:
aDate - value to convert
Returns:
double equivalent

toDoubleAsDate

public static final double toDoubleAsDate(java.util.Date aDate)
Convert a Java Date to double, treating value as a Date with a zero time component

Parameters:
aDate - value to convert
Returns:
double equivalent

toDoubleAsDateOnly

public static final double toDoubleAsDateOnly(double aDate)
convenience function to pick out only the Date portion of a double leaving it with a zero time component.

Parameters:
aDate - double to strip to days
Returns:
double number of days

toDoubleAsTime

public static final double toDoubleAsTime(java.util.Date aDate)
Convert a Java Date to double, treating value as a Time with a zero date component

Parameters:
aDate - value to convert
Returns:
double equivalent

toDoubleAsTimeOnly

public static final double toDoubleAsTimeOnly(double aDate)
convenience function to pick out only the Time portion of a double leaving it with a zero date component

Parameters:
aDate - double to strip to time
Returns:
double fraction of day

toDateAsDateTime

public static final java.util.Date toDateAsDateTime(double aDate)
convience function to convert a double to a Date with both date and time components retained

Parameters:
aDate - double value to convert
Returns:
equivalent Java Date

toDateAsDateOnly

public static final java.util.Date toDateAsDateOnly(double aDate)
convience function to convert a double to a Date with only the date component retained

Parameters:
aDate - double value to convert
Returns:
equivalent Java Date

toDateAsTimeOnly

public static final java.util.Date toDateAsTimeOnly(double aDate)
convience function to convert a double to a Date with only the time component retained

Parameters:
aDate - double value to convert
Returns:
equivalent Java Date

getMonths

public static final java.lang.String[] getMonths(java.lang.String aLocale)
Returns Locale specific full months names.

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
String[] array of month names

getWeekdays

public static final java.lang.String[] getWeekdays(java.lang.String aLocale)
Returns Locale specific full weekday names.

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
String[] array of week names

getShortWeekdays

public static final java.lang.String[] getShortWeekdays(java.lang.String aLocale)
Returns Locale specific short week names.

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
String[] array of short week names

getFirstWeekDay

public static int getFirstWeekDay(java.lang.String aLocale)
Returns first day of the week

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
int first day of the week

getLocalizedNames

public static java.util.Locale[] getLocalizedNames(java.lang.String aLocale)
Returns array of Locales sorted by locale specific display names

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
Locale[] list of locales

getShortDateFormat

public static java.lang.String getShortDateFormat(java.lang.String aLocale)
Returns the modified SHORT date format with a 4-digit year for a locale

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
String SHORT date format for a locale

getAmPmStrings

public static java.lang.String[] getAmPmStrings(java.lang.String aLocale)
Returns Am Pm Strings

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
String[] Am Pm Strings

getShortDateTimeFormat

public static java.lang.String getShortDateTimeFormat(java.lang.String aLocale)
Returns the modified SHORT date time format with a 4-digit year for a locale

Parameters:
aLocale - locale name, if null or blank, the default locale is used
Returns:
String SHORT date time format for a locale

getFormat

public static final 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. A new instance should be retrieved EACH time it is needed, since this same instance will be used by PRDateFormat when called in the same Java thread.

Parameters:
aLocale - locale name, if null or blank the default locale is used
aPattern - pattern or name for the format
Returns:
cached DateFormat instance

getFormatPattern

public static final 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.

Parameters:
aLocale - locale name, if null or blank the default locale is used
aPattern - pattern or name for the format
Returns:
pattern string for the specified format (name)


Copyright © 2012 Pegasystems Inc. All Rights Reserved.