javascript转换日期字符串(Java Date.toLocalString())为Date对象

方法一:

var strArray = str.split(" ");   
var strDate = strArray[0].split("-");   
var strTime = strArray[1].split(":");   
var a = new Date(strDate[0],(strDate[1]-parseInt(1)),strDate[2],strTime[0],strTime[1],strTime[2])

方法二:

var s = "2005-12-15 09:41:30";   
var d = new Date(Date.parse(s.replace(/-/g,"/")));


你可能感兴趣的:(JavaScript)