本文为翻译,英文原版的Cheat Sheet(PDF版本)在此下载:http://aspnetresources.com/downloads/ms_ajax_library_cheat_sheets1.zip
注:标注有[S]的为静态方法,无须实例化对象即可使用。
[S] Boolean.parse (value )
从字符串表示的布尔值解析成相应的Boolean类型。value参数必须为“true”或“false”二者之一,不区分大小写,且可以包含空格。
var b = Boolean.parse("true");
Date.format (format)
格式化字符串(区域设定无关)。
var d = new Date();
Sys.Debug.trace (d.format("dddd, dd MMMM yyyy HH:mm:ss"));
Date.localeFormat (format)
格式化字符串(区域设定相关)。使用Sys.CultureInfo.CurrentCulture得到区域属性。
var d = new Date();
Sys.Debug.trace (d.localeFormat("dddd, dd MMMM yyyy HH:mm:ss"));
[S] Date.parseLocale (value, formats)
从字符串表示的本地时间日期解析成相应的Date类型。使用Sys.CultureInfo.CurrentCulture得到区域属性。
Sys.Debug.trace (Date.parseLocale ("4/10/2001", "yyyy-MM-dd",
"MM/dd/yyyy"));// Date.parseLocale will skip the first format here as invalid and use// the second one. If it does not find an appropriate format,// the function throws an exception.
[S] Date.parseInvariant (value, formats)
从字符串表示的区域无关时间日期解析成相应的Date类型。
Sys.Debug.trace (Date.parseInvariant ("4/10/2001", "yyyy-MM-dd",
"MM/dd/yyyy"));// Date.parseInvariant will skip the first format here as invalid and use// the second one. If it does not find an appropriate format,// the function throws an exception.
支持的格式