I made this code:
import java.text.SimpleDateFormat;
import java.util.*;
import javax.swing.*;
public class TimeBox{
public static void main(String[] args) {
Calendar calendar = new GregorianCalendar();
int hour = calendar.get(Calendar.HOUR);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
JOptionPane.showMessageDialog("Current Time", hour + ":" + minute + ":" + second);
}
}
And I get an error.
y u no work?
Getting the Current TimeAleksandar April 12, 2011 at 6:23 PM
Hi! I added this line: int month = calendar.get(Calendar.MONTH); and what I got was one month less than the actual month. Why is it so?
RequestRajesh August 24, 2011 at 3:44 PM
need online Run for all programs...
dynamic clockMsObond July 19, 2012 at 2:44 PM
what about a program that shows a dynamic clock , where the seonds are actually increasing on the same spot.
about errorganesh dudhade August 21, 2012 at 12:59 PM
int hour = calendar.get(Calendar.HOUR); incorrect this is correct int hour = calendar.get(Calendar.HOUR_OF_DAY);
Count down clockMandla November 12, 2012 at 6:31 PM
How to creat a count down program that shuts down my computer.
HelpJavaNub January 6, 2013 at 6:00 PM
I made this code: import java.text.SimpleDateFormat; import java.util.*; import javax.swing.*; public class TimeBox{ public static void main(String[] args) { Calendar calendar = new GregorianCalendar(); int hour = calendar.get(Calendar.HOUR); int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); JOptionPane.showMessageDialog("Current Time", hour + ":" + minute + ":" + second); } } And I get an error. y u no work?
Post your Comment