I am getting UTC timestamp from database which is I am setting into a JodaTime DateTime
instance
DateTime dt = new DateTime(timestamp.getTime());
It stores the time perfectly say 10:00 AM
but with local time zone. E.g, I am in IST time zone which is +5:30 from UTC
I have tried lots of things for changing the timezone but with every thing it changes the time from 10:00 AM
to something else by using +5:30 difference
Is there any way by which I can change TimeZone without affecting current time
EDIT:
If my current time is:
2013-09-25 11:27:34 AM UTC
Following is the result when I use this new DateTime(timestamp.getTime());
2013-09-25 11:27:34 AM Asia/Kolkata
And following is the result when I use this new DateTime(timestamp.getTime(), DateTimeZone.UTC)
;
2013-09-25 05:57:34 AM UTC
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…