Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
ASP.NET Reference
Client Reference
Global Namespace
Date Type Functions
 format Function

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Date.format Function

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

var a = dateVar.format(format);
format

A format string.

A string that contains the formatted date value.

Exception type

Condition

Sys.ArgumentException

format is invalid.

Use the format method to replace the date object value with a text representation based on the format parameter. The format method formats a date using the invariant (culture-independent) culture. The invariant culture is culture-insensitive.

The following format strings are supported: D, d, T, t, F, f, M, m, s, Y, y. For more information about format strings, see Standard Date and Time Format Strings. For more information about globalizing dates, see Walkthrough: Globalizing a Date by Using Client Script.

Use the format method when the formatted value depends on a string comparison or a case-change operation. 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 format method is not affected by the EnableScriptGlobalization()()() attribute of the ScriptManager class.

For more information about date and time string formats, see Sys.CultureInfo Class.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker