Export (0) Print
Expand All

Date.parseLocale Function

Creates a date from a locale-specific string by using the current culture. This function is static and can be invoked without creating an instance of the object.

var a = Date.parseLocale(value, formats);

value

A locale-specific string that represents a date.

formats

(Optional) An array of custom formats.

If value is a valid string representation of a date, an object of type Date; otherwise, null.

Exception type

Condition

Sys.ArgumentException

(Debug) formats contains an invalid format.

Use the pareseLocale function to create an object of type Date from a string. If you provide no custom formats, this function uses the Sys.CultureInfo.CurrentCulture property to determine the culture value.

To create a date from a locale-specific string that uses the current culture, set the EnableScriptGlobalization property of the ScriptManager control to true. You must also modify settings in the Web.config file so that the culture attribute of the globalization section is set to auto.

NoteNote

This type does not support the locale values th-TH, ar-SA, dv-MV, prs-AF, and ps-AF.

Community Additions

Show:
© 2014 Microsoft