In this tutorial, We will learn how to get the month name from date using momentjs. We will show the momentjs get month name from date.
Example:
<!DOCTYPE html>
<html>
<head>
<title>Jquery Moment Js Get Month Name From Date</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</h1>
</body>
<script type="text/javascript">
var oneDate = moment('26-03-2021', 'DD-MM-YYYY');
var monthName = oneDate.format('MM');
document.write(monthName);
var oneDate = moment();
var monthName = oneDate.format('MMMM');
document.write(monthName);
</script>
</html>
Output:
03 March |
Thanks, May this example will help you....