parseDate (I18n - JavaScript)
Analyzes the given string, by applying the given pattern in the given locale. If the string contains no time zone indication, it is considered that the given string has been input in the given time zone. For example, a user enters "01/01/2003 00:00" to mean 00:00 in his time zone. The returned date is in the XSP server time zone.
This method is permissive. For example, a date will be interpreted even if separators are not strictly respected. (01/01/2003 is ok with pattern dd-MM-yyyy) The pattern may be a predefined pattern (represented by i18n constants) These patterns are localizable : the exact format changes depending on the locale. The pattern may also be an explicit pattern ('dd/MM/yyyy').
This kind of pattern is not impacted by the locale, except if MMM or MMMM is used (short or complete names of months) If the pattern is missing or null, the string is parsed by using the format. For example, the following string may be correctly interpreted if the given locale is a US locale : '1/14/03 4:33 AM." If the Locale parameter is missing or null, the string is interpreted according to the XSP server default locale
Defined in
I18nSyntax
parseDate(date:string, pattern:string, loc:Locale) : Date
parseDate(date:string, pattern:string, tz:TimeZone) : Date
parseDate(date:string, pattern:string, loc:Locale, tz:TimeZone) : Date
parseDate(date:string, pattern:string) : Date
Parameters | Description |
---|---|
date |
The string to parse. |
pattern |
The pattern that 'date' is supposed to match. |
loc |
The locale used to translate a predefined pattern ( means M/d/yy in US). |
tz |
The time zone the given 'date' was entered in. |
Return value | Description |
---|---|
Date |
A Date object (in the XSP server TZ) that corresponds to the given string. |