File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How do I get a current date and time in a JLabel? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I get a current date and time in a JLabel?" Watch "How do I get a current date and time in a JLabel?" New topic
Author

How do I get a current date and time in a JLabel?

Aaron Parker
Greenhorn

Joined: Jan 31, 2004
Posts: 27
I can't get this to compile. How do I get a date into the label?
Aaron Parker
Greenhorn

Joined: Jan 31, 2004
Posts: 27
(Before I had Date dateAndTime = new Date(); just above JLabel dateTime)
Carlos Failde
Ranch Hand

Joined: Oct 20, 2000
Posts: 84
Howdy.
Date dateAndTime = Calendar.getInstance().getTime();
JLabel dateTime = new JLabel(dateAndTime.toString());
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I get a current date and time in a JLabel?