aspose file tools*
The moose likes Java in General and the fly likes Formatting Date Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Formatting Date Object" Watch "Formatting Date Object" New topic
Author

Formatting Date Object

Adewale Adebusoye
Ranch Hand

Joined: Sep 28, 2005
Posts: 118
I would like to format an object of java.util.Date into the dd/mm/yy format. Im using it for a database program in which the date is implicitly inserted into a table when a function is called, and ive been trying to get the date in dd/mm/yy format.
Any ideas?


"Human beings can alter their lives by altering their state of mind" William James
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

If you're trying to format the date into a String (in whatever format) so that you can insert it into a database table, in a column that is declared as DATE, then the best idea is to not do that. Use a PreparedStatement:However if it's a text column (which also sounds like not such a good idea) or if you just need the date formatted so you can display it, then use a java.text.SimpleDateFormat object to do that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatting Date Object