programming-examples/js/Date/Write a JavaScript function to get a short textual representation of a month, three letters (Jan through Dec)..js
2019-11-15 12:59:38 +01:00

12 lines
336 B
JavaScript

Date.shortMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function short_months(dt)
{
return Date.shortMonths[dt.getMonth()];
}
dt = new Date();
console.log(short_months(dt));
dt = new Date(2015, 10, 1);
console.log(short_months(dt));