我想从日期获取日期名称。假设我有 2014-04-02 的日期。当天的名字应该是星期三。我怎样才能从给定的日期获得这一天的名字date.I am给我的js给我数字日,如 02 ......
$(".datepicker").datepicker(
{
dateFormat: "yy-mm-dd",
onSelect: function (date)
{
var date = $("#dateNew"+i).val();alert(date);
var res = date.split("-");
alert("Value"+res[1]);
}
});
对此有何想法?
答案 0 :(得分:0)
尝试:
var today = new Date();
var dayArray = ['Sunday','Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var day = dayArray[today.getDay()];
console.log(day);
答案 1 :(得分:0)
这样的东西我会猜测
var arrDaysName= new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var curDay = new Date();
alert(arrDaysName[curDay.getDay()]);