aspose file tools*
The moose likes JDBC and the fly likes getTimeStamp() returns a UTC time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getTimeStamp() returns a UTC time" Watch "getTimeStamp() returns a UTC time" New topic
Author

getTimeStamp() returns a UTC time

Anupam Bhatt
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
Hi,
I am doing the following sequence of steps to get the time from a column in database.

Timestamp ts1 = rs.getTimeStamp(1);
Date myDate = new Date(ts1.getTime());

This returns me a time according to database locale, however i require the time accroding to the JVM's locale.

I guess there must be some conversion api's [is using calendar the solution?]
any pointers?

Thanks,
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Anupam,
It's actually just returning you a Date object which doesn't have a locale. Take a look at SimpleDateFormat for outputting it using different locales.

You mentioned UTC times. Do you mean timezones rather than locales?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getTimeStamp() returns a UTC time