How to get current day name with jquery

I am wondering whether it is possible to get the current day name like monday, tuesday, thursday.. with jquery. Is there a kind of plug in or do you even know how to do that?

I build a timetable in which different html files are loaded in via jquery, so the page won't refresh. I want to name the files of the timetable after the day names so that jquery can load it automatically in when the initial page is loaded.

thanks in advance!

Answers


Using jQUery Library and jQuery UI library

Check live jsFiddle
JQuery
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";

$(document).ready(function() {
    $('#datepicker').datepicker( {
        onSelect: function(dateText, inst) {
            var date = $(this).datepicker('getDate');
            var dayOfWeek = weekday[date.getUTCDay()];
            document.getElementById('datepicker').value = dayOfWeek;
        }
    });
});

HTML

<p>Date: <input type="text" id="datepicker"></p>

Need Your Help

spyOn(Date, 'now') does not work in Firefox or IE

javascript firefox jasmine

In Jasmine I want to spyOn and mock the return value of Date.now.

SharePoint 2010: Copy documents between lists

c# sharepoint-2010

What is the best way to copy all documents from one sharepoint document list to another programmatically?