The moose likes Other JSE/JEE APIs and the fly likes get the system time(urgent) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "get the system time(urgent)" Watch "get the system time(urgent)" New topic
Author

get the system time(urgent)

netharam ram
Ranch Hand

Joined: Aug 09, 2001
Posts: 202
How can I get the system time as it is displayed in the system tray.I want to display a clock in my frame and update it every second.I just don't want to create an instance of date and get the time form it.Please help me, even if it uses JNI.Urgent please.
Shumaiza Manzoor
Greenhorn

Joined: Sep 03, 2001
Posts: 6
hi, i think it will help u!
Locale locale = new Locale("pak","");

DateFormat fmt = DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,locale);

fmt.setTimeZone(TimeZone.getDefault());

String st = fmt.format(new java.util.Date());
System.out.println(st);

dont forget to import java.util package.
 
IntelliJ Java IDE
 
subject: get the system time(urgent)
 
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com