Hello All
How can I get day of given date using jQuery? In c# I do it like this
if(MyDate.DayOfWeek == DayOfWeek.Sunday)
How can i do this in jQuery?
Hello All
How can I get day of given date using jQuery? In c# I do it like this
if(MyDate.DayOfWeek == DayOfWeek.Sunday)
How can i do this in jQuery?
Using javascript, you can find the day of week: Date.getDay();
Say you have something like this:
Date d = new Date(...);
d.getDay(); // returns day of week.
Careful as it's zero-based so it will return from 0 to 6.
You could use JavaScript's Date.getDay()
$(document).ready(function() {
var d = new Date();
alert(d.getDay());
} );
As stated you don't need jQuery to use this but I've wrapped it in jQuery for your pleasure. As stated by nc3b the result its 0 based where 0 is Sunday.