Results 1 to 3 of 3
  1. #1
    malakaherath is offline Member
    Join Date
    Aug 2007
    Rep Power

    Default dynamically updating clock

    is there a class to get the cureent time from the system and allow it to run as a clock. I mean display the time like a real clock.

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    For time you can try:
    Java Code:
    DateFormat df = new SimpleDateFormat("hh:mm");
    Calendar calendar = Calendar.getInstance();
    Date date = new Date();
    System.out.printf("calendar time = %s%n         date = %s%ntime = %s%n",
                       calendar.getTime(), date, df.format(date));
    For milliseconds you can use System.currentTimeMillis().

  3. #3
    levent Guest


    You can use Timer class to call a method every seconds and you can also get system time with Java. By combining these, i think you can implement what you want.

Similar Threads

  1. Help please in digital clock
    By jaidod in forum Java Applets
    Replies: 1
    Last Post: 04-17-2008, 04:05 PM
  2. clock class program
    By jvasilj1 in forum New To Java
    Replies: 12
    Last Post: 02-01-2008, 08:27 PM
  3. Pogo clock problem
    By tampacurt in forum New To Java
    Replies: 0
    Last Post: 11-17-2007, 02:18 AM
  4. Updating Graphics
    By Greedful in forum Java 2D
    Replies: 2
    Last Post: 07-20-2007, 07:12 PM
  5. Updating into 2 tables in the DB
    By yuchuang in forum New To Java
    Replies: 2
    Last Post: 05-12-2007, 06:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts