Friday, November 16, 2007

Dates and numbers

The complexities of formatting really come into play when dealing with dataes and numbers. The ASP.NET AJAX Library adds format and localeFomat methods to the string, date and number objects. The format and methods are key for effectively controlling output.


var d = new Date();
var message = String.localeFormat("{0}\n{1}\n{2}\n{3}\n{4}\n{5}\n{6}\n{7}",
d.format("d"),
d.format("D"),
d.format("t"),
d.format("T"),
d.format("F"),
d.format("M"),
d.format("s"),
d.format("Y") );
alert(message);

No comments: