programming-examples/java/_Basics/How to find which week of the year, month.java

11 lines
463 B
Java
Raw Normal View History

2019-11-15 12:59:38 +01:00
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Date d1 = new Date();
Calendar cl = Calendar. getInstance();
cl.setTime(d1);
System.out.println("today is "+ cl.WEEK_OF_YEAR+ " week of the year");
System.out.println("today is a "+cl.DAY_OF_MONTH + "month of the year");
System.out.println("today is a "+cl.WEEK_OF_MONTH +"week of the month");
}
}