This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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?
 
Similar Threads
How to get these two classes to interact?
GridLayout troubles
Help with screen output in applet
Layout problems!!
appletviewer