This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Date Format change Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Date Format change" Watch "Date Format change" New topic
Author

Date Format change

Dan Silva
Ranch Hand

Joined: Sep 05, 2007
Posts: 86
Hi,
I want the date to be displayed with MM\DD\YYYY instead of the default, with the year first. What's the command to do this. Thanks
Dan Silva
Ranch Hand

Joined: Sep 05, 2007
Posts: 86
Sorry, I'm looking to do this in SQL. Thanks.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43900
    
  32
I had a look in the MySQL manual and found this. Look particularly at the first additional comment at the bottom.
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3740
    
  10

If its part of JDBC, use ResultSet.getDate() and Java's SimpleDateFormat to change the format. The specific command varies on different databases.


[OCA 8 Book] [Blog]
 
Have you checked out Aspose?
 
subject: Date Format change
 
It's not a secret anymore!