js 日期字符串转换成日期类型,判断星期几

var weekDay = ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
var dateStr = "2008-08-08 08:08:08"
var myDate = new Date(Date.parse(dateStr.replace(/-/g, "/")));
alert(weekDay[myDate.getDay()]);

你可能感兴趣的:(js 日期字符串转换成日期类型,判断星期几)