格式化json日期格式对象
调用toDate(timeString)
/**
* 时间对象的格式化
*/
Dateprototypeformat = function(format) {
/*
* format=yyyyMMdd hh:mm:ss;
*/
var o = {
M+ : thisgetMonth() +
d+ : thisgetDate()
h+ : thisgetHours()
m+ : thisgetMinutes()
s+ : thisgetSeconds()
q+ : Mathfloor((thisgetMonth() + ) / )
S : thisgetMilliseconds()
}
if (/(y+)/test(format)) {
format = formatreplace(RegExp$ (thisgetFullYear() + )substr(
RegExp$length))
}
for (var k in o) {
if (new RegExp(( + k + ))test(format)) {
format = formatreplace(RegExp$ RegExp$length ==
? o[k]
: ( + o[k])substr(( + o[k])length))
}
}
return format;
}
//{date:day:hours:minutes:month:seconds:time:timezoneOffset:year:}
function toDate(obj){
var date = new Date()
datesetTime(objtime)
datesetHours(objhours)
datesetMinutes(objminutes)
datesetSeconds(objseconds)
return dateformat(yyyyMMdd hh:mm:ss)
}