ItSolutionStuff.com

Moment JS Get Day Name from Date Example

By Hardik Savani • January 8, 2021
jQuery

Now, let's see post of moment get day name from date. 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. you will learn moment js get day name from date. you will do the following things for moment get day name example.

Here, i will give you simple example of jquery moment js get day name from date using format('dddd').

let's see both example with output:

Example:

<!DOCTYPE html>

<html>

<head>

<title>jquery moment 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 example - ItSolutionStuff.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>

Output:

Saturday

Friday

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

šŸ“ŗ Subscribe on YouTube