A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
getTimeStamp() returns a UTC time
Joined: Mar 12, 2004
Jan 05, 2007 09:10:00
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?]
author & internet detective
Joined: May 26, 2003
Jan 05, 2007 17:34:00
It's actually just returning you a Date object which doesn't have a locale. Take a look at
for outputting it using different locales.
You mentioned UTC times. Do you mean timezones rather than locales?
OCA 8 book
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
I agree. Here's the link:
subject: getTimeStamp() returns a UTC time
Extracting and Comparing Data
Calendar with Locale
Display date and time in users Timezone?
Stumped By HashSet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015