Moment Get Current Week Number Example

Moment Get Current Week Number Example

Hello friends,

Today we will show how to get current week number using moment js in jQuery. In this example we learn example of moment get current week number.

Here, we will show moment js get current week number, jQuery moment get current week number,  jQuery moment js get current week number using week() function.

Read also : JavaScript Array Remove Element

jQuery moment get current week number

<!DOCTYPE html>
<html>
<head>
    <title>jQuery Moment Get Current Week Number  - web-tuts.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 Week Number - web-tuts.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 you understand of how to get current week number using moment and it can help you…

Read also : Moment JS Get Last Date of Month Example