Java Display Week Number Of The Year
Chapter:
Date and Time
Last Updated:
03-09-2016 11:46:05 UTC
Program:
/* ............... START ............... */
import java.util.*;
public class JavaWeekNumberOfYear {
public static void main(String[] args) throws Exception {
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
System.out.println("today is " + calendar.WEEK_OF_YEAR + " week of the year");
System.out.println("today is a " + calendar.DAY_OF_MONTH + "month of the year");
System.out.println("today is a " + calendar.WEEK_OF_MONTH + "week of the month");
}
}
/* ............... END ............... */
Output
today is 3 week of the year
today is a 5month of the year
today is a 4week of the month
Tags
Display Week Number Of The Year, Java, Date And Time