• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DB timestamp value with JVM TimeZone

 
Ricky Ru
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dears,

If we have database timestamp "1970-01-01T16:00:00", no matter what Time Zone the jvm is running with, we get the java.sql.Timestamp object representing the time "1970-01-01T16:00:00" locally(Shang Hai, Las Vegas, London...). So, the UTC time will be different as well.

I need to do some conversion work to make database timestamp "1970-01-01T16:00:00" as UTC time. Although it will be different in jvms with different time zones, they all mean the same time(UTC time, same million seconds from UTC Time 1970-01-01T00:00:00.000) and will be consistent.

So, do you know how to convert a local java.sql.Timestamp to a UTC timestamp?(Actually, they're two different times.) For example, I want to convert java.sql.Timestamp("1970-0101T16:00:00+8:00") from database to java.util.Timestamp("1970-01-01T16:00:00UTC"). The literals are same.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic