简体   繁体   中英

Java timezone & AWS EC2

I am receiving a ISO8601 time from the client, converting it into UTC, and saving it as a timestamp on AWS EC2 server, with a DateTimeZone as follows

    DateTime groupExpectedDate = sentGroup_expected_date_time.withZone(cityTimezone);

    Timestamp groupExpectedDateTimestamp = new Timestamp(groupExpectedDate.getMillis());

when i run the code on my local server, the times are assigned correctly for that specific city. However, when I push to the AWS EC2 server, the times are wrong. Is there a configuration on AWS EC2 i should be performing?

You should set Timezone consistently across your environment servers, either forcing the Locale in Java code, or setting the timezone in your underlying OS (which is not stated in your question)

Which Timestamp class are you using? The one from java.sql.Timestamp or another?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM