Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating a String from DateTime

 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at:SimpleDateFormat The Javadoc contains patterns that are similar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic