wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Creating a String from DateTime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Creating a String from DateTime" Watch "Creating a String from DateTime" New topic
Author

Creating a String from DateTime

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1393
I need to generate a 14 character string from the current DateTime. I will use this as an index for new created records. I need it in the format:

Year(4),Month(2),Day(2),Hour(2),Minute(2),Second(2)
20070724010101
Jay Damon
Ranch Hand

Joined: Jul 31, 2001
Posts: 282
Look at:SimpleDateFormat The Javadoc contains patterns that are similar.
 
 
subject: Creating a String from DateTime
 
Similar Threads
Manipulation Date Time In RMS
Date calculation
Problem adding JComboBox to JFrame
Convert DateTime Error
Passing Date in Callable Statement