4

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 <selected package>
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:~$ 
Kerem
  • 11,377
  • 5
  • 59
  • 58
mark
  • 727
  • 3
  • 14
  • 35
  • Please see my answer: http://stackoverflow.com/a/40416306/6804200 i cant solve this. I did not want to update again my queestion. it was too long to put inside comment so i added as answer. – mark Nov 04 '16 at 06:08

2 Answers2

7

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.

Community
  • 1
  • 1
Magnilex
  • 11,584
  • 9
  • 62
  • 84
  • Our spring boot docker applications are on linux machines. If turkey again starts to use daylight, should we again download or only command line is enough? – mark Nov 03 '16 at 12:24
  • 2
    Since the command example I gave you uses the latest info from iana, as long as it has been published there, that command should do. – Magnilex Nov 03 '16 at 12:27
  • 1
    Use time zone updater. Normally minor JDK updates do not update timezone data since this could change the behavior of some applications, causing subtle and unexpected bugs. – Michał Kosmulski Nov 03 '16 at 13:01
  • 2
    @MichałKosmulski But some of them are included (see http://www.oracle.com/technetwork/java/javase/tzdata-versions-138805.html), and Oracle themselves advice to update the JRE in those cases. – Magnilex Nov 03 '16 at 13:20
  • 1
    @Magnilex It seems you're right. Some do get included while others don't and I don't quite see the pattern. – Michał Kosmulski Nov 03 '16 at 13:29
  • @mark As I said in my answer, the information about the Turkey timezone has not (yet) been patched in a Java minor version. You would need to patch the JRE with the timezone data of your choice. The latest _should_ work, but I would double check what information that includes. That should be available on the iana site. – Magnilex Nov 03 '16 at 13:51
  • root@vegan:/home/vegan/Downloads/tzdb# java -jar tzdata-latest.tar.gz Error: Invalid or corrupt jarfile tzdata-latest.tar.gz – mark Nov 03 '16 at 19:31
  • You must unzip them.. `sudo tar -xvzf tzdata-latest.tar.gz`. See more [here](http://askubuntu.com/questions/25347/what-command-do-i-need-to-unzip-extract-a-tar-gz-file). – WesternGun Nov 03 '16 at 22:24
3

The Answer by Magnilex is correct, and should be accepted. Anybody concerned with time in Turkey needs to immediately update their tz database bundled with Java.

Version tzdata2016g of the time zone data files has the change for Turkey that you need.

Turkey switched from EET/EEST (+02/+03) to permanent +03, effective 2016-09-07.

And version tzdata2016h has some fixes for Turkey in the 1980s and 1990s.

In Turkey, transitions in 1986-1990 were at 01:00 standard time not at 02:00, and the spring 1994 transition was on March 20, not March 27.

But the current Java SE 8 Update 111 & 112 have the earlier version tzdata2016f.

tz not updated as of Java 8 Update 111

My experiment below shows this last-minute change in time zone by the government of Turkey was not included in the tz database bundled with the most recent update to Java from Oracle, Java 8 Update 111.

Get first moment on the day DST was previously scheduled to end. Then add one hour at a time to see if clock jumps or not.

System.out.println ( "java.version: " + System.getProperty ( "java.version" ) );

ZoneId z = ZoneId.of ( "Europe/Istanbul" );
ZonedDateTime zdt = ZonedDateTime.of ( 2016 , 10 , 30 , 0 , 0 , 0 , 0 , z );

System.out.println ( "    zdt: " + zdt );
System.out.println ( "zdt + 1: " + zdt.plusHours ( 1 ) );
System.out.println ( "zdt + 2: " + zdt.plusHours ( 2 ) );
System.out.println ( "zdt + 3: " + zdt.plusHours ( 3 ) );
System.out.println ( "zdt + 4: " + zdt.plusHours ( 4 ) );
System.out.println ( "zdt + 5: " + zdt.plusHours ( 5 ) );
System.out.println ( "zdt + 6: " + zdt.plusHours ( 6 ) );

When run. At 4 AM, the clock jumps back to repeat the 03:00 hour. This meant DST ended, but should not have if we were up-to-date with new Turkish law.

java.version: 1.8.0_111
    zdt: 2016-10-30T00:00+03:00[Europe/Istanbul]
zdt + 1: 2016-10-30T01:00+03:00[Europe/Istanbul]
zdt + 2: 2016-10-30T02:00+03:00[Europe/Istanbul]
zdt + 3: 2016-10-30T03:00+03:00[Europe/Istanbul]
zdt + 4: 2016-10-30T03:00+02:00[Europe/Istanbul]
zdt + 5: 2016-10-30T04:00+02:00[Europe/Istanbul]
zdt + 6: 2016-10-30T05:00+02:00[Europe/Istanbul]
Community
  • 1
  • 1
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • but according to here it has that change http://www.oracle.com/technetwork/java/javase/tzdata-versions-138805.html look tzdata2016g please . but i cant manage to use it – mark Nov 04 '16 at 05:15
  • 1
    @mark You misread that page. Look at the second column for `tzdata2016g` and `tzdata2016h`… empty. Those updates to the tz data have **not yet been shipped with any version of Java**. You must apply such updates yourself to your JVM using the *TZUpdater* tool as described in the [Answer by Magnilex](http://stackoverflow.com/a/40401351/642706). As of today (2016-11-03), the latest version of Java SE is Java 8 Update 111 (& 112), which contains `tzdata2016f` shown in the third row of your linked page. Politicians twiddle with time zones faster than Oracle et al. can ship new versions of Java. – Basil Bourque Nov 04 '16 at 05:40
  • Last question sir please. the column is now empty for tzdata2016g. when they release it, should i change again? – mark Nov 06 '16 at 13:57