//年月日 function myformatter(date){ var y = date.getFullYear(); var m = date.getMonth()+1; var d = date.getDate(); return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d); }
function myparser(s){ if (!s) return new Date(); var ss = (s.split('-')); var y = parseInt(ss[0],10); var m = parseInt(ss[1],10); var d = parseInt(ss[2],10); if (!isNaN(y) && !isNaN(m) && !isNaN(d)){ return new Date(y,m-1,d); } else { return new Date(); } }
//年月日时分秒 function clsFormatter(dateV){ var dateVal=new Date(Date.parse(dateV.toString())); var y = dateVal.getFullYear(); var m = dateVal.getMonth()+1; var d = dateVal.getDate(); var h=dateVal.getHours(); var m2=dateVal.getMinutes(); //var s=date.getSeconds(); var resultVal=y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d)+' '+(h<10?('0'+h):h)+':'+(m2<10?('0'+m2):m2); return resultVal; }
function clsParser(s){ if (!s) return new Date(); var s1=s.split(' '); var sa=s1[0]; var sb=s1[1]; var ss = (sa.split('-')); var y = parseInt(ss[0],10); var m = parseInt(ss[1],10); var d = parseInt(ss[2],10); var tt = (sb.split(':')); var h = parseInt(tt[0]); var mi = parseInt(tt[1]);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)&& !isNaN(h)&& !isNaN(mi)){ return new Date(y,m-1,d,h,mi); } else { return new Date(); }