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
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#