programming-examples/js/Date/Write a JavaScript function to get a textual representation of a day (three letters, Mon through Sun)..js

12 lines
274 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
Date.shortDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
function short_Days(dt)
{
return Date.shortDays[dt.getDay()];
}
dt = new Date();
console.log(short_Days(dt));
dt = new Date(2015, 10, 1);
console.log(short_Days(dt));