Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
109
rated 0 times [  111] [ 2]  / answers: 1 / hits: 15306  / 13 Years ago, sat, june 25, 2011, 12:00:00

How can i alert the selected days name? Example 'Monday'.



So when you pick 7th june 2011 it will alert Tuesday



<script>
$(function() {
$( #date ).datepicker({
dateFormat: 'dd/mm/yy',
onSelect: function(dateText, inst) {
// how can i grab the day name of the day, example Monday and alert it out?
// alert( ? );
}
});
});
</script>

More From » jquery

 Answers
69

The jQueryUI's Datepicker comes with a formatDate function that can do that for you. If you're using a localized version, it'll show the days in that language too.



onSelect: function(dateText, inst) {
var date = $(this).datepicker('getDate');
alert($.datepicker.formatDate('DD', date));
}


For more information on localization of on Dapicker's utility functions, have a look at http://jqueryui.com/demos/datepicker/.


[#91498] Friday, June 24, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jackelyn

Total Points: 303
Total Questions: 103
Total Answers: 102

Location: Turks and Caicos Islands
Member since Sun, Mar 7, 2021
3 Years ago
jackelyn questions
Thu, Apr 8, 21, 00:00, 3 Years ago
Sun, Feb 28, 21, 00:00, 3 Years ago
Mon, May 25, 20, 00:00, 4 Years ago
Thu, Apr 30, 20, 00:00, 4 Years ago
;