Get full name of a month from a Javascript date object
Extend the Date object with this handy method:
Date.prototype.getMonthName = function() {
var months = ["January", "Feburary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
return months[this.getMonth()];
};
Now you can use dFoo.getMonthName() to return more than just a zero-based # of the month on your dates!!
<feel free to add dating puns to the comments/>
Written by Lee
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#