success:function(data){
var str=""
for(var i=0;i<data.length;i++){
str+=data[i].FINDATE+data[i].FINMATH+data[i].FINNAME+data[i].FINTYPE
alert(str)
}
$('#id1').html(str);
各位老大怎么将data[i].FINDATE 通过 date 类型显示出来
//------------------------------------------------------------------ var Tool = { //获取当前的系统时间 GetNowFormatDate: function () { var date = new Date(); var seperator1 = "-"; var seperator2 = ":"; var month = date.getMonth() + 1; var strDate = date.getDate(); if (month >= 1 && month <= 9) { month = "0" + month; } if (strDate >= 0 && strDate <= 9) { strDate = "0" + strDate; } var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate + " " + date.getHours() + seperator2 + date.getMinutes() + seperator2 + date.getSeconds(); return currentdate; }, /** * 格式化日期(不含时间) */ formatterDate: function (date) { if (date == undefined) { return ""; } /*json格式时间转js时间格式*/ date = date.substr(1, date.length - 2); var obj = eval('(' + "{Date: new " + date + "}" + ')'); var date = obj["Date"]; if (date.getFullYear() < 1900) { return ""; } var datetime = date.getFullYear() + "-"// "年" + ((date.getMonth() + 1) > 10 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1)) + "-"// "月" + (date.getDate() < 10 ? "0" + date.getDate() : date .getDate()); return datetime; }, /** * 格式化日期(含时间"00:00:00") */ formatterDate2: function (date) { if (date == undefined) { return ""; } /*json格式时间转js时间格式*/ date = date.substr(1, date.length - 2); var obj = eval('(' + "{Date: new " + date + "}" + ')'); var date = obj["Date"]; if (date.getFullYear() < 1900) { return ""; } /*把日期格式化*/ var datetime = date.getFullYear() + "-"// "年" + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1)) + "-"// "月" + (date.getDate() < 10 ? "0" + date.getDate() : date .getDate()) + " " + "00:00:00"; return datetime; }, /** * 格式化去日期(含时间) */ formatterDateTime: function (date) { if (date == undefined) { return ""; } /*json格式时间转js时间格式*/ date = date.substr(1, date.length - 2); var obj = eval('(' + "{Date: new " + date + "}" + ')'); var date = obj["Date"]; if (date.getFullYear() < 1900) { return ""; } var datetime = date.getFullYear() + "-"// "年" + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1)) + "-"// "月" + (date.getDate() < 10 ? "0" + date.getDate() : date .getDate()) + " " + (date.getHours() < 10 ? "0" + date.getHours() : date .getHours()) + ":" + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date .getMinutes()) + ":" + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date .getSeconds()); return datetime; } };
用法 :Tool.formatterDate2(data[i].FINDATE) 格式化后显示时间
new Date(data[i].FINDATE);
判断元素类型,给你举个小例子
var a=1 typeof(a) alert(typeof(a) 会提示number
参照我之前写的这个,复制后,直接调用即可!renderTime(data[i].FINDATE); http://www.cnblogs.com/qh1688/p/4981423.html