Skip to main content
deleted 44 characters in body
Source Link
Noy
  • 62
  • 6

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"]; // empty first value because it starts at 0
console.log(months[res[1]-1]) // month name 

JSFiddle: https://jsfiddle.net/p8fwhydc/1/

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"]; // empty first value because it starts at 0
console.log(months[res[1]-1]) // month name 

JSFiddle: https://jsfiddle.net/p8fwhydc/1/

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"];
console.log(months[res[1]-1]) // month name 

JSFiddle: https://jsfiddle.net/p8fwhydc/1/

deleted 2 characters in body
Source Link
Noy
  • 62
  • 6

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["", "Jan"["Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"]; // empty first value because it starts at 0
console.log(months[res[1]]months[res[1]-1]) // month name 

JSFiddle: https://jsfiddle.net/p8fwhydc/1/

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["", "Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"]; // empty first value because it starts at 0
console.log(months[res[1]]) // month name 

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"]; // empty first value because it starts at 0
console.log(months[res[1]-1]) // month name 

JSFiddle: https://jsfiddle.net/p8fwhydc/1/

Source Link
Noy
  • 62
  • 6

If you were looking to just get the month name from the month number, you could use this:

var str = "2017-11-22"; // this would be your date
var res = str.split("-"); // turn the date into a list format (Split by / if needed)
var months = ["", "Jan", "Feb", "March", "April", "May", "June", "July", 
"August", "September", "October", "November", "December"]; // empty first value because it starts at 0
console.log(months[res[1]]) // month name