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 日期字符串转换成日期类型,格式化为周期)