storm_to
storm_to

Reputation: 1575

How to convert java.sql.Timestamp value from EST to UTC timezone

I have a java.sql.Timestamp variable in local timezone with following formatting

2011-07-21 00:40:37

I need to convert it to UTC

I asked this question to see if it can be done by mysql, but received no answers.

I guess I have to somehow do it in java code before substituting it in the query

Upvotes: 0

Views: 2207

Answers (1)

plor
plor

Reputation: 282

I recommend using Joda Time to parse the timestamp. You'll need to set the timezone to EST and then get the UTC time from there. You could do the same thing with the generic Java Date, but Joda is easier to work with.

Upvotes: 2

Related Questions