File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Help with Date conversion from PostgreSQL database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Help with Date conversion from PostgreSQL database" Watch "Help with Date conversion from PostgreSQL database" New topic
Author

Help with Date conversion from PostgreSQL database

zsa tan
Greenhorn

Joined: Mar 24, 2009
Posts: 2
Good morning!

I have a question regarding date conversion from Postgresql DB.
You see I am querying a date from the DB

when I view the values they are in this sample format
"1982-01-14 12:34:56.000000 +08:00:00"

I would retrieve the date column
rs.getDate(note this is in date type)
I would store them in an object with the birthday attribute (which is a Date type)

my question is how can i convert tahat into Jan, 01. 1982?

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

I would store them in an object with the birthday attribute (which is a Date type)

A Date does not hold any format. You don't need to do anything.

my question is how can i convert tahat into Jan, 01. 1982?

Why ? You want to hold it as a String ? If yes, you can do it using SimpleDateFormat. Can you find out which format to use ?


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with Date conversion from PostgreSQL database
 
Similar Threads
convert datetime from EST to PST
JDBC template outer join and cast(@myValue AS date)
24 Hour Format In HQL - 00:00:00 returned as 24:00:00 using HQL
Converting to UTC time zone
Date & Time