Moment JS Get Month Name from Date Example

This tutorial shows you moment js get month name from date. if you want to see example of moment js get month from date then you are a right place. This article goes in detailed on get month name from date moment jquery. This article goes in detailed on jquery moment get month from date. Let’s see bellow example how to get month name from date in moment js.

Here, i will give you simple example of jquery moment js get month name from date using format(‘MMMM’).

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 oneDate = moment('02-01-2021', 'DD-MM-YYYY');

var monthName = oneDate.format('MM');

console.log(monthName);

var oneDate = moment();

var monthName = oneDate.format('MMMM');

console.log(monthName);

</script>

</html>

Output:

01

January

I hope it can help you…

1 thought on “Moment JS Get Month Name from Date Example”

Leave a Comment