Moment JS Get Day Name From Date Example

Jquery

Nicesnippets

2064

27-04-2021


Hi guys,

In this blog, i will show you how to get day name from date using moment js in jquery. We will talk about moment js get day name from date example. This article will give you how to get day name from date example.

I’m going to show you about how to get day name from date in moment js. if you have question about how to get day name from date in jquery then i will give simple example with solution.

Here i will give you full example for how to get day name from date in moment js. So let's see the bellow example:

Example


<!DOCTYPE html>

<html>

<head>

<title>jquery moment 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 example - NiceSnippets.com</h1>

</body>

<script type="text/javascript">

var oneDate = moment('02-01-2021', 'DD-MM-YYYY');

var dayName = oneDate.format('dddd');

console.log(dayName);

var oneDate = moment();

var dayName = oneDate.format('dddd');

console.log(dayName);

</script>

</html>

It will help you....


Recommended Posts