import java.util.Calendar;
public class GetMethod {
public static void main(String[] av) {
Calendar calendar = Calendar.getInstance();
System.out.println("Year: " + calendar.get(Calendar.YEAR));
System.out.println("Mnth: " + calendar.get(Calendar.MONTH));
System.out.println("Day: " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("Day of week = " + calendar.get(Calendar.DAY_OF_WEEK));
System.out.println("Day of year = " +calendar.get(Calendar.DAY_OF_YEAR));
System.out.println("Week in Year: " + calendar.get(Calendar.WEEK_OF_YEAR));
System.out.println("Week in Mnth: " + calendar.get(Calendar.WEEK_OF_MONTH));
System.out.println("Day of Week in Mnth: "
+ calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println("Hour (24-hour clock): "
+ calendar.get(Calendar.HOUR_OF_DAY));
System.out.println("Mint: " + calendar.get(Calendar.MINUTE));
System.out.println("Secnd: " + calendar.get(Calendar.SECOND));
}
}
public class GetMethod {
public static void main(String[] av) {
Calendar calendar = Calendar.getInstance();
System.out.println("Year: " + calendar.get(Calendar.YEAR));
System.out.println("Mnth: " + calendar.get(Calendar.MONTH));
System.out.println("Day: " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("Day of week = " + calendar.get(Calendar.DAY_OF_WEEK));
System.out.println("Day of year = " +calendar.get(Calendar.DAY_OF_YEAR));
System.out.println("Week in Year: " + calendar.get(Calendar.WEEK_OF_YEAR));
System.out.println("Week in Mnth: " + calendar.get(Calendar.WEEK_OF_MONTH));
System.out.println("Day of Week in Mnth: "
+ calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println("Hour (24-hour clock): "
+ calendar.get(Calendar.HOUR_OF_DAY));
System.out.println("Mint: " + calendar.get(Calendar.MINUTE));
System.out.println("Secnd: " + calendar.get(Calendar.SECOND));
}
}
Post a Comment