javascript string to date
还只能用"/"分割时间,“-”还就是不行。
<SCRIPT LANGUAGE="JavaScript">
//execScript('n = DateDiff("d","2003-01-01","2003-01-02")');//document.write(n);
var s="2003-01-01";
var s2="2003-01-03";
var date=new Date(Date.parse(s.replace(/-/g, "/")));
var date2=new Date(Date.parse(s2.replace(/-/g, "/")));
var str=date2.getTime()-date.getTime();
var sr=str/(24*3600*1000);
//alert(39*365*24*3600*1000);
alert(sr);
</SCRIPT>
posted on 2010-05-28 14:59 flyingchen 阅读(4037) 评论(0) 编辑 收藏 举报