import java.util.Calendar;
public class Main {
public static void main(String[] args) {
Calendar now = Calendar.getInstance();
System.out.println("Current Hour in 12 hour format is : " + now.get(Calendar.HOUR));
System.out.println("Current Hour in 24 hour format is : " + now.get(Calendar.HOUR_OF_DAY));
System.out.println("Current Minute is : " + now.get(Calendar.MINUTE));
System.out.println("Current Second is : " + now.get(Calendar.SECOND));
System.out.println("Current Millisecond is : " + now.get(Calendar.MILLISECOND));
}
}
|