Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
685 views
in Technique[技术] by (71.8m points)

spring - Java timezone in turkey (rejected daylight saving)

Turkey decided recently (September 6, 2016 ) to permanently stay in Daylight Saving Time (DST). This act canceled the ending of DST previously scheduled for October 30, 2016, 04:00:00. Clocks were not changed.

Turkey is between +2 and +3 utc, so now it will stay in +3. Here you can see

https://www.timeanddate.com/time/change/turkey/ankara?year=2016

…and in the Wikipedia page, Time in Turkey, and this Hurriyet Daily News article, Turkey to implement daylight savings time year-round.

Here they discuss but I have an application in Spring Boot.

Android TimeZone Turkey GMT

cmntWrapper.setCreatedAtString(cmnt.getCreatedAt().
now(ZoneId.of(Constants.TURKEY_ZONE)).
format(DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT)));

this is how i take my date.

This shows the hour 13.50 now but now it is 14.50. Because we are in +3.

What can i do?

I dont want to use utc +3 because they can say next year, "lets again use to +2-+3 switching to daylight saving concept". So i cant risk.

I cant change code in future weeks, it will stay permanent after a few weeks.

What do you suggest for permanent?

and also how can i make java? because for my test linux machine , see this please

puapp@PU-APP-01:~$ java version The program 'java' can be found in the following packages: * default-jre * gcj-4.8-jre-headless * openjdk-7-jre-headless * gcj-4.6-jre-headless * openjdk-6-jre-headless Try: sudo apt-get install puapp@PU-APP-01:~$

puapp@PU-APP-01:~$ whereis java java: /usr/share/java puapp@PU-APP-01:~$

puapp@PU-APP-01:~$ whereis java java: /usr/share/java

But in local i have java.

vegan@vegan:~$ java -version java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode) vegan@vegan:~$

but local is not important. that linux server is immportant.

and for our main machine, there is java

produp@Produp-app-01:~$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
produp@Produp-app-01:~$ 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The prefered way to do this would be to update the JDK/JRE, if it includes the new timezone information. If it is not included, the correct, and official way to do this, should be to update the Timezone information using the Timezone Updater Tool.

The TZUpdater tool is provided to allow you to update installed Java Development Kit (JDK) and Java Runtime Environment (JRE) software with more recent timezone data, to accommodate daylight saving time (DST) changes in different countries. Oracle relies on the timezone data publicly available through IANA's Time Zone Database.

Oracle recommends that you use the latest Oracle Java SE platform JDK or JRE update release as the preferred means of delivering both timezone data updates and other product improvements, such as security fixes. To see which JDK or JRE update release incorporates the updated timezone data for your locale, see Timezone Data Versions in the JRE Software. However, if you are unable to use Oracle's latest JDK or JRE update release or if the timezone data on the latest release is not the most current one available, the TZUpdater tool provides a means of updating timezone data while leaving other system configuration and dependencies unchanged.

It is available as a download on the official Java SE download site (under the section Additional Resources).

Information about your particular case can be found here (where you can also see that the information is not available in a JRE release):

Turkey switched from EET/EEST (+02/+03) to permanent +03, effective 2016-09-07. New leap second 2016-12-31 23:59:60 UTC as per IERS Bulletin C 52.

How to use the tool is explained in the doucentation:

The TZUpdater tool modifies the JDK/JRE software instance that is used to execute the tool. A single image of the JDK/JRE software is modified per execution. To administer the tool to multiple instances of the JDK/JRE software, see the section Systemwide Usage.

For example, the below command would update the JRE with the latest information, where the changes in Turkey daylight saving should be included.

java -jar tzupdater.jar -l http://www.iana.org/time-zones/repository/tzdata-latest.tar.gz


Note that there is a current known issue since the 2016g release:

Due to formatting changes in the IANA-maintained tzdata bundle, the TZUpdater tool fails to determine the tzdata version when parsing the tzdata2016.tar.gz resource bundle.

Follow the steps from the below link in order to be able to use the latest tzdata bundle from IANA. When this is fixed, this section of the answer will be removed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...