开发者

Javascript globalization problem in asp.net

function GetDa开发者_JAVA百科teInLocalFormat(strDate) {

if (strDate == undefined)
    return ""

var dateVal = new Date(strDate));
if (dateVal == null || isNaN(dateVal)) {    
    return "";
}

    return dateVal.localeFormat(Sys.CultureInfo.CurrentCulture.dateTimeFormat.ShortDatePattern);

}

I'm using the above function in Javascript display the date in localized format, new Date(strDate) is not working as expected.

Any suggestions to do date globalization in Javascript?


Try the Globalize library (originating from Microsoft, it was promoted as an official jQuery plugin, and then made available as a simple Javascript library).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜