js to get the week, get the day of the week according to the date string, get the week from the date, and get the week from the time
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
Sweet Potato Yao December 30, 2016 08:47:38 Friday
http://fanshuyao.iteye.com/
/** * Is it Null * @param object * @returns {Boolean} */ function isNull(object){ if(object == null || typeof object == "undefined"){ return true; } return false; };
/** * Get the day of the week from the date string * @param dateString date string (eg: 2016-12-29), if it is empty, it is the current date of the user's computer * @returns {String} */ function getWeek(dateString){ var date; if(isNull(dateString)){ date = new Date(); }else{ var dateArray = dateString.split("-"); date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]); } //var weeks = new Array("日", "一", "二", "三", "四", "五", "六"); //return "星期" + weeks[date.getDay()]; return "week" + "day one two three four five six".charAt(date.getDay()); };
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
Sweet Potato Yao December 30, 2016 08:47:38 Friday
http://fanshuyao.iteye.com/