Moment Get Current Week Number Example

By Hardik Savani | January 9, 2021 | Category : jQuery


This article will give you example of moment get current week number. I’m going to show you about how to get current week number in moment js. This post will give you simple example of moment js get current week number. you will learn jquery moment get current week number.

Here, i will give you simple example of jquery moment js get current week number using week().

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 weekNumber = moment('02-01-2021', 'DD-MM-YYYY').week();

console.log(weekNumber);

var weekNumber = moment().week();

console.log(weekNumber);

</script>

</html>

Output:

1

2

I hope it can help you...



Tags : jQuery Moment JS


Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: