C# Js 时间格式化问题
C# 后台:
.ToString("dd-MMM-yyyy", System.Globalization. DateTimeFormatInfo.InvariantInfo) eg : 29-Aug-2013
Js 前台:
monName = new Array( "Jan", "Feb" , "Mar", "Apr", "May" , "Jun", "Jul", "Aug" , "Sept", "Oct", "Nov" , "Dec")
Date.prototype.format = function (format) {
if (!format) {
format = "yyyy-MM-dd hh:mm:ss";
}
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, ( this.getFullYear() + "" ).substr(4 - RegExp.$1.length));
}
if (/(M+)/.test(format)) {
format = format.replace(RegExp.$1, (monName[ this.getMonth()] + "" ).substr(3 - RegExp.$1.length));
}
if (/(d+)/.test(format)) {
format = format.replace(RegExp.$1, ( "00" + this .getDate() + "").substr(( "" + this .getDate()).length));
}
return format;
};
function formatJsonDate(str) {
if (str != null &&str!='') {
return (new Date(parseInt(str.substring(str.indexOf( '(') + 1, str.indexOf(')' ))))).format("dd-MMM-yyyy");
}
else {
return '' ;
}
讨论群请加QQ群181537678
世上本无垃圾,所谓垃圾是你放错了地方
作者:Elite.net
出处:http://www.cnblogs.com/yhyjy/
新浪微博:http://weibo.com/u/2709913775
世上本无垃圾,所谓垃圾是你放错了地方!
每天积累一点点,那么理想便会距离我们越来越近!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://www.cnblogs.com/yhyjy/
新浪微博:http://weibo.com/u/2709913775
世上本无垃圾,所谓垃圾是你放错了地方!
每天积累一点点,那么理想便会距离我们越来越近!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

浙公网安备 33010602011771号