0% found this document useful (0 votes)
67 views1 page

Microsoft Word - MS Ajax Date and Boolean Extensions

The document discusses methods for formatting dates in JavaScript using the Microsoft AJAX Library. It describes Date.format(), which formats a date using the invariant culture, and Date.localeFormat(), which formats a date using the current culture. It also describes Date.localeParse(), which parses a locale-specific string into a Date object, and provides examples of supported format strings.

Uploaded by

astojic24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views1 page

Microsoft Word - MS Ajax Date and Boolean Extensions

The document discusses methods for formatting dates in JavaScript using the Microsoft AJAX Library. It describes Date.format(), which formats a date using the invariant culture, and Date.localeFormat(), which formats a date using the current culture. It also describes Date.localeParse(), which parses a locale-specific string into a Date object, and provides examples of supported format strings.

Uploaded by

astojic24
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Date.

localeParse (value, formats)


Microsoft AJAX Library: Boolean Type Extensions Creates a date from a locale-specific string. value is a locale-specific string that can
be parsed as a date, and formats (optional) is an array of custom formats. Returns
Boolean.parse (value ) an object of type Date.
Converts a string representation of a logical value to its Boolean object equivalent. Remarks
The value argument must be a string representation of a Boolean value containing
either "true" or "false" (case insensitive). The string can contain white space. This function uses the Sys.CultureInfo.CurrentCulture property to determine
var b = Boolean.parse("true");
the culture value.
debug.trace (Date.parse ("4/10/2001", "yyyy-MM-dd", "MM/dd/yyyy"));
// Date.parse will skip the first format here as invalid and use
Microsoft AJAX Library: Date Type Extensions // the second one. If it does not find an appropriate format,
// the function throws an exception.

Date.parse (value, formats)


Date. format (format) Creates a date from a string. value is a locale-specific string that can be parsed as a
Formats a date using the invariant (culture-independent) culture. date, and formats (optional) is an array of custom formats. Returns an object of
Remarks type Date.
debug.trace (Date.parse ("4/10/2001", "yyyy-MM-dd", "MM/dd/yyyy"));
The invariant culture is culture-insensitive. It is associated with the English // Date.parse will skip the first format here as invalid and use
language but not with any country or region. If a security decision depends on a // the second one. If it does not find an appropriate format,
string comparison or a case-change operation, use the Date.format method. This // the function throws an exception.
makes sure that the behavior will be consistent regardless of the culture settings of
the system. Supported formats
Below are examples of supported formats to use with Date.format and
The invariant culture must be used only by processes that require culture- Date.localeFormat (only invariant culture shown):
independent results, such as system services. Otherwise, the method can produce
results that might be linguistically incorrect or culturally inappropriate. Format Formatted date
var d = new Date();
debug.trace (d.format("dddd, dd MMMM yyyy HH:mm:ss")); d Short date pattern (e.g.: 02/17/2007)

Date.localeFormat (format) D Long date pattern (e.g: Saturday, 17 February 2007)


Formats a date using the current culture. t Short time pattern (e.g.: 22:10)
Remarks T Long time pattern (e.g.: 22:10:30)
The format parameter determines how the date will be presented. The F Full date pattern (e.g.: Saturday, 17 February 2007 22:10:30)
localeFormat method provides the date based on a specific culture value (locale).
The culture value is also used to display web information for specific language and m (or M) Month and day pattern (e.g.: February 17)
country combinations.
s Sortable date and time pattern (e.g.: 2007-02-17T22:10:30)
This function uses the Sys.CultureInfo.CurrentCulture property to determine
the culture value. y (or Y) Year and month pattern (e.g.: 2007 February)
var d = new Date();
debug.trace (d.localeFormat("dddd, dd MMMM yyyy HH:mm:ss"));

A function is static and is invoked without creating an instance of the object Based on Microsoft AJAX Library RC1 • Compiled by Milan Negovan • www.AspNetResources.com • Last update: 2007-01-11

You might also like