title: Java Time Zone Database vs IANA data
body: <p>There is a Daylight Savings Time discrepancy between the IANA database and the Java tzdb.dat 2019c 
  database in the Africa/Cassablanca time zone that has me very confused.  There may be others but I found this one.  From what I can tell the IANA time zone database clearly shows that DST is supported in Morocco (Africa/Casablanca) unfortunately the Java time zone database tzdb.dat in the 2019c release does not agree. This has and will cause me infinite grief.  What am I missing here,  or have others seen this kind of thing</p>
  
  <p>The IANA table 2019c for Africa/Casablanca</p>
  
  <p><strong>Note: the part of the table below shows that the normal time is UTC+1 and Day light savings time is UTC a slash (/) separates standard and daylight abbreviations</strong></p>
  
  <h1>Zone  NAME        STDOFF  RULES   FORMAT  [UNTIL]</h1>
  
  <p>Zone Africa/Casablanca  -0:30:20 -  LMT 1913 Oct 26</p>
  
  <pre><code>         0:00   Morocco +00/+01 1984 Mar 16
           1:00   -   +01 1986
           0:00   Morocco +00/+01 2018 Oct 28  3:00    
           1:00   Morocco +01/+00
  </code></pre>
  
  <p>From Oct 28 2018 till present offset is +1 for standard and +0 for daylight savings  (a slash (/) separates standard and daylight abbreviations.)
  STDOFF 1:00 so The amount of time to add to UT to get standard time, without any adjustment for daylight saving this corresponds to UTC +1 that is the current Morocco time. 
  So we take Zone Africa/Casablanca which is UTC and add the offsets +01/+00 depending on Ramadan.'</p>
  
  <p>The test </p>
  
  <p>I wrote a simple Java class to check the 2019c TZDB. This class (shown below) shows that something is wrong with the latest Java time zone data file  tzdb.dat file.  This test was run using IBM SR5FP40 with the time zone 2019c data file. I had the same results with OpenJDK using a 2019c datafile.</p>
  
  <p>First line from tzdb.dat shows 2019c
   TZDB  2019cX Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers </p>
  
  <p>Test that shows the problem </p>
  
  <p>Time Zone = Africa/Casablanca
  Supports Day light Savings time  = false
  Date Mon May 20 00:00:00 WET 2019 is currently in DST false
  Time zone name Western European Time
  Time zone ID Africa/Casablanca</p>
  
  <p>A baseline test was also run to show if DST is supported the code will show it.</p>
  
  <p>Time Zone = Europe/Rome
  Supports Day light Savings time  = true
  Date Mon May 20 00:00:00 CEST 2019 is currently in DST true
  Time zone name Central European Time
  Time zone ID Europe/Rome</p>
  
  <p>The code is here for reference</p>
  
  <pre><code>import java.util.*; 
  import java.text.SimpleDateFormat;
  import java.text.ParseException;
  
  public class checkdaylight{ 
  
      public static void main(String[] args) 
      { 
  
          // Create TimeZone object
          //Europe/Rome
          //Pacific/Pago_Pago
          //Africa/Casablanca
          String TimezoneToTest = "Africa/Casablanca";
          System.out.println("Time Zone = " + TimezoneToTest);
          TimeZone obj = TimeZone.getTimeZone(TimezoneToTest); 
          TimeZone.setDefault(TimeZone.getTimeZone(TimezoneToTest)); //to avoid confusion
  
          // Checking day light time 
          // and displaying the result 
          System.out.println("Supports Day light Savings time  = "
                          + obj.useDaylightTime()); 
          String pattern = "yyyy-MM-dd";
          SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
          try{
              simpleDateFormat.setTimeZone(TimeZone.getTimeZone(TimezoneToTest));
              Date checkdate = simpleDateFormat.parse("2019-05-20");
              System.out.println("Date " + checkdate.toString()+ " is currently in DST "+ obj.inDaylightTime(checkdate));
           } catch (ParseException e) {
              e.printStackTrace();
          }
  
          System.out.println("Time zone name " +obj.getDisplayName());
          System.out.println("Time zone ID " + obj.getID());
  
      } 
  } 
  </code></pre>