使用 Jquery 从日期获取星期几

Get the day of the week from a date using Jquery?

本文关键字:取星期几 日期 Jquery 使用      更新时间:2023-09-26

我现在以前已经知道了,问题是我从输入中获取的日期不是当前日期。

我需要得到星期几。目前我得到这种格式的日期:

11/09/2013

但我希望它像:

Saturday/02/2013. 

正在使用日期选择器来显示日历,因此这可能是一些可以帮助我使用相同的插件的解决方案。

var date = new Date();
var weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var weekday = weekdays[date.getDay()];
var month = date.getMonth() + 1;
var year = date.getYear();