Moment Get Current Week Number Example
Hi Guys,
Now let's see example of how to get current week number using momentjs in jquery. We will talk about momentjs get current week number example using jquery. In 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.
Here, i will give you simple example of jquery moment js get current week number using week().
So let's see both example with output:
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 weekNumber = moment('02-04-2021', 'DD-MM-YYYY').week();
console.log(weekNumber);
var weekNumber = moment().week();
console.log(weekNumber);
</script>
</html>
Output :
4
2
It will help you....
- How to Use the groupmod Command in Linux?
- How to Restrict Access to a Folder with htaccess?
- How to Zip UnZip Files And Directories In Linux using Command Line?
- Laravel 8 Refresh DataTable Without Reloading Page
- How to Model Disable Primary Key & Auto Increment Tutorial?
- How to Remove WordPress Version Number?
- How to Count Total Number of Bits in Number?
- Flutter Route and Navigation Example