The records are getting saved according to time zone of US but if I want to show the same record back to user it should convert the server date time with(US Time Zone) to user's date time with user's Time Zone
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
java.time
The old date-time classes are poorly designed, confusing, and troublesome. Avoid them.
Use modern classes: the java.time framework built into Java 8 and later. Find back-ports for earlier Java 6 & 7 and for Android.
An
Instant
is a moment on the timeline in UTC.Apply a time zone (
ZoneId
) to get aZonedDateTime
.Never use the 3-4 letter zone abbreviations such as
EST
orIST
. They are neither standardized nor unique(!). Use proper time zone names, built in acontinent/region
format such asAsia/Kolkata
,Pacific/Auckland
,America/Los_Angeles
.Apply a different time zone to generate another
ZonedDateTime
adjusted to that time zone. CallwithZoneSameInstant
.If you want to go back to UTC, ask for an
Instant
.Code To Get Berlin Time and Convert it into UTC Time
If you type in google "Java date change timezone" or "Javascript date change timezone". You will have one of your results:
In Java (source: http://www.coderanch.com/t/417443/java/java/Convert-Date-one-timezone-another )
Javascript (source: http://www.techrepublic.com/article/convert-the-local-time-to-another-time-zone-with-this-javascript/6016329 )