JQuery - Moment JS Get Month Name from Date Example

Jquery

Nicesnippets

1814

18-03-2021


JQuery - Moment JS Get Month Name from Date Example

Hello Friends,

Now let's see example of how to get month name from date using momentjs. We will show 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 tutorial will give you moment js get month name from date.

Here, i will give you simple and easy 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 Js Get Month Name From Date - NiceSnippets.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 Js Get Month Name From Date - NiceSnippets.com</h1>

</body>

<script type="text/javascript">

var oneDate = moment('02-03-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

03

March

It will help you....


Recommended Posts