How to Get Next Month Date in Moment JS?

03-Jun-2021

.

Admin

Hello Guys,

Now let's see example of how to get next month date using momentjs. This article will give you simple example of momentjs get next month date. We will show how to get next month date from current date in momentjs.

Moment.js provides a wrapper for the native JavaScript date object. I will learn how to get next month date in jquery moment.

Here I will give full example for jquery moment get next month date. So let's see below example:

Example :


<!DOCTYPE html>

<html>

<head>

<title>How to Get Next Month Date in Moment JS? - 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>How to Get Next Month Date in Moment JS? - NiceSnippets.com</h1>

<script type="text/javascript">

var nextMonthDate = moment().add(1, 'months').format('DD-MM-YYYY');

console.log(nextMonthDate);

var startDateTime = '03-06-2021'

var nextMonthDate = moment(startDateTime, "DD-MM-YYYY")

.add(1, 'months')

.format('LL');

console.log(nextMonthDate);

var nextMonthName = moment(startDateTime, "DD-MM-YYYY")

.add(1, 'months')

.format('MMMM');

console.log(nextMonthName);

</script>

</body>

</html>

Output

03-07-2021

July 3, 2021

July

It will help you....

#Jquery