How to Get Week Number in Java

In this example, We will show you simple program about, How to get week number in Java. The program has been tested and output shared in the same post.

Example Program

package com.dineshkrish;
import java.util.Calendar;
* @author Dinesh Krishnan
public class Example {
public static void main(String[] args) throws Exception {
Calendar now = Calendar.getInstance();
int weekNumber = now.get(Calendar.WEEK_OF_YEAR);
System.out.println("The week number is : " + weekNumber);


The week number is : 19


1. Calendar Class

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *