在开发的内部应用系统中,使用JQuery从SQL取数据,使用JS显示日期,当SQL服务器上短日期格式设置为2010-08-02时,JS没法直接用new Date(strDate)生成JS Date对象,产生错误。javascript
解决方法:html
一、修改服务器上的地区日期格式为2010/08/02java
二、修改JS代码,增长两行,处理日期字符串服务器
strDate=strDate.replace('-'.'/')this
strDate=strDate.replace('-'.'/')spa
http://www.isstudy.com/javascript/1871.htmlhtm
var thisday=new Date()
var thisday2=new Date("08/09/1999")
var thisday3=new Date("08/09/1999 20:15:15")对象
版权声明:本文为博主原创文章,未经博主容许不得转载。ip