JQuery Moment Get Current Date Example

By Hardik Savani December 23, 2020 Category : jQuery

Hi Bro,

Are you looking for example of jquery moment get current date. you can see jquery moment current date format. Here you will learn jquery moment js current date unix. you will learn jquery moment.js current date toISOString.

Here is a very simple example of how to get current date using jquery moment js. i will show you some moment method that getting current date.

Let's see simple example with output:

index.html

<!DOCTYPE html>

<html>

<head>

<title>JQuery Moment Get Current Date 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 Get Current Date Example - ItSolutionStuff.com</h1>

</body>

<script type="text/javascript">

var currentDate1 = moment();

console.log('Current Date 1: ' + currentDate1);

var currentDate2 = moment().format();

console.log('Current Date 2: ' + currentDate2);

var currentDate3 = moment().format('MM/DD/YYYY');

console.log('Current Date 3: ' + currentDate3);

var currentDate4 = moment().unix();

console.log('Current Date 4: ' + currentDate4);

var currentDate5 = moment().toISOString();

console.log('Current Date 5: ' + currentDate5);

</script>

</html>

Output:

Current Date 1: 1608694675255

Current Date 2: 2020-12-23T09:07:55+05:30

Current Date 3: 12/23/2020

Current Date 4: 1608694675

Current Date 5: 2020-12-23T03:37:55.257Z

I hope it can help you...

Tags :
Shares