This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to format datetime? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to format datetime?" Watch "How to format datetime?" New topic

How to format datetime?

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
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?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
jQuery in Action, 2nd edition
subject: How to format datetime?
Similar Threads
problem with selecting data between two dates in sqlserver
NumberFormatException while inserting data into database
How to compare 2 Dates in String Format
Date format... please help
using java.util.Logging to generate a txt log file