Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.








Date.format Function

Formats a date by using the invariant (culture-independent) culture.


var a = dateVar.format(format);



A format string.

Return Value

A string that contains the formatted date value.


Exception Type Condition


format is invalid.


Use the format method to replace the date object value with a text representation based on the format parameter. The invariant culture is culture-insensitive. If a decision depends on a string comparison or a case-change operation, use the Date.format method. This makes sure that the behavior is consistent regardless of the culture settings of the system.

The invariant culture must be used only by processes that require culture-independent results, such as system services. Otherwise, the method can produce results that might be linguistically incorrect or culturally inappropriate.

The Date.format method is not affected by the EnableScriptGlobalization attribute of the ScriptManager class.

For more information about date and time string formats, see Standard DateTime Format Strings and Standard DateTime Format Strings Output Examples.