JQuery Moment Add Days to Date Example

Jquery

Nicesnippets

530

14-06-2021


Hi Guys,

In this example,I will learn you how to add days to date in moment js.you can easy amd simply add to days to date in moment js.

Here, i will give you simple example of jquery moment js add() method for add days to date.let's bellow the example.

Example :


<!DOCTYPE html>

<html>

<head>

<title>JQuery Moment Add Day Example - 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 Add Day Example - Nicesnippets.com</h1>

</body>

<script type="text/javascript">

var startdate = '15-06-2021'

var newDate = moment(startdate, "DD-MM-YYYY").add(4, 'days').format('DD/MM/YYYY');

console.log(newDate);

</script>

</html>

Output:

19/06/2021

It will help you...


Recommended Posts