Moment JS Get Month Name from Number Example
Hi,
This tutorial is focused on moment get month name from number. This post will give you simple example of jquery moment get month name from number. let’s discuss about moment js get month name from number. In this article, we will implement a how to get month name from month number in jquery.
Here, i will give you simple example of jquery moment js format() method with 'MMMM' that will provide you month name from number.
let's see both example with output:
Example
<!DOCTYPE html>
<html>
<head>
<title>jquery moment example - ItSolutionStuff.com</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" crossorigin="anonymous"></script>
</head>
<body>
<h1>jquery moment example - ItSolutionStuff.com</h1>
</body>
<script type="text/javascript">
var monthName = moment('10', 'MM').format('MMMM');
console.log(monthName);
</script>
<script type="text/javascript">
var startDateTime = '26-12-2020'
var monthName = moment(startDateTime, "DD-MM-YYYY")
.format('MMMM');
console.log(monthName);
</script>
</html>
Output:
October
December
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- JQuery Moment Add Hours to Datetime Example
- JQuery Moment Add Minutes to Datetime Example
- JQuery Moment Subtract Year from Date Example
- JQuery Moment Subtract Month Example
- JQuery Moment Add Days to Date Example
- JQuery Moment Get Current Date Example
- How to Install and Use Moment JS in Laravel?
- How to Change Date Format using Moment in Vue JS?
- How to Change Date Format in JQuery?