How to Get Week Number in Java Program

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