以下是示例代码
第一效应:
不小时
功能jsondateformat(jsondate){ / / JSON数据格式
转换成普通格式
{试
VaR
日期=新的日期(parseInt(jsondate.replace(/Date(
VaR月= date.getmonth()+1<10 0 +(date.getmonth)+(1)+(1):date.getmonth;
VaR天= date.getdate()<10 0 + date.getdate():date.getdate();
返回date.getfullyear()+-+月+-+天;
} catch(前){
返回;
}
}
二效应:
只是有时候每分每秒
功能jsondateformat(jsondate){ / / JSON数据
格式转换成普通格式
{试
VaR日期=新的日期(parseInt(jsondate.replace(/Date(
VaR月= date.getmonth()+1<10 0 +(date.getmonth)+(1)+(1):date.getmonth;
VaR天= date.getdate()<10 0 + date.getdate():date.getdate();
无功小时= date.gethours();
VaR分钟= date.getminutes();
VaR秒= date.getseconds();
VaR毫秒= date.getmilliseconds();
返回date.getfullyear()+-+月+-+日+时间+:+时间+:+秒++毫秒;
} catch(前){
返回;
}
}
总结
以上是由javascript
格式化的JSON日期的全部内容,虽然它非常小,但非常实用。希望您能在
学习中有所帮助。