一个JS的问题,求大虾的帮助。谢谢~~ 本帖最后由 wwqisis 于 2013-08-16 14:24:25 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/atree/archive/2011/06/29/JS-JavaScript-Date-Format.html 变量点Substring(0,10).Replace('/','-') ? 变量点Substring(0,10).Replace('/','-') ? var a = type[i]["SUBMITTIME"] alert(a); a = a.Substring(0, 10).Replace('/', '-'); alert(a); function test() { var str = "2006/04/04 14:20:34"; var nowStr = new Date(str); alert(nowStr.format("yyyy-MM-dd")); } Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, //month "d+": this.getDate(), //day "h+": this.getHours(), //hour "m+": this.getMinutes(), //minute "s+": this.getSeconds(), //second "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() //millisecond }; if (/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); } for (var k in o) { if (new RegExp("(" + k + ")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); } } return format; };输出2006-04-04 这样是等于重写了日期的foramt C# 正则表达式示例代码 导出Excel列头中文乱码 C# 如何把 图处理成 反相呢????????????????????????????????????????????????????????? 求一个正则表达式 谁有C#中listview关于数据库添加,删除,修改的例子给小弟发一个,不胜感激。[email protected] .Net 2003在winXP中调试的问题 richtextbox 请高手帮忙C#取值的问题. 奇怪的comboBox的数据绑定问题! C#如何访问注册表? 并行生成文件冲突问题 Winform读取Word 内容并保存成PDF用itextsharp怎么实现
变量点Substring(0,10).Replace('/','-') ?
变量点Substring(0,10).Replace('/','-') ? var a = type[i]["SUBMITTIME"]
alert(a);
a = a.Substring(0, 10).Replace('/', '-');
alert(a);
var str = "2006/04/04 14:20:34";
var nowStr = new Date(str);
alert(nowStr.format("yyyy-MM-dd"));
}
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
};
if (/(y+)/.test(format)) {
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(format)) {
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
}
}
return format;
};
输出2006-04-04