Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to format datetime?

 
Siegfried Heintze
Ranch Hand
Posts: 408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing following presently when fetching date from JDBC:


Please tell me there is a better way! How can I format my date with a single formatter?
Thanks,
Siegfried
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15490
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can just use SimpleDateFormat. Why do you think you need separate formatters for the date and time parts?

See the API documentation of java.text.SimpleDateFormat for info on the format specification string.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic