<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Wrong date using Java/JDBC (1940-06-14 is missing) in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199441#M4384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works for me. I'm using SAS 9.4 M0 with an IOM based JDBC connection rather than SAS/SHARE and I get a continuous sequence of dates including 14Jun1940.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Off the top of my head, I'm wondering if it might be a daylight savings time (DST) interaction where a day increment plus a time change ticks the other side of midnight and loses a date. &lt;SPAN style="font-size: 13.3333330154419px;"&gt;What time zone are you in? I'm in GMT+10 with no DST. &lt;/SPAN&gt;You're setting a day value in the SAS code but the JDBC getDate() method is returning a date &amp;amp; time and so time and DST may be a factor here perhaps? Interestingly, I read that there were significant differences in DST during the 2nd world war - the UK was in British Double Summer Time (BDST) from 1940-1945 for example: &lt;A href="http://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation" title="http://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation"&gt;British Summer Time - Wikipedia, the free encyclopedia&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Apr 2015 08:03:23 GMT</pubDate>
    <dc:creator>PaulHomes</dc:creator>
    <dc:date>2015-04-20T08:03:23Z</dc:date>
    <item>
      <title>Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199439#M4382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider this dataset:&lt;/P&gt;&lt;P&gt;libname ud 'C:\Aktuar';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data ud.datoer;&lt;/P&gt;&lt;P&gt;do datof='1JUN1940'd to '1JUL1940'd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dato=datof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;format datof yymmdd10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dataset is then read using Java/JDBC:&lt;/P&gt;&lt;P&gt;&amp;nbsp; try {&lt;/P&gt;&lt;P&gt;&amp;nbsp; Class.forName("com.sas.net.sharenet.ShareNetDriver");&lt;/P&gt;&lt;P&gt;&amp;nbsp; Properties props = new Properties();&lt;/P&gt;&lt;P&gt;&amp;nbsp; Connection conn;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Statement stmt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; props.setProperty("librefs", "x '" + "C:/Aktuar" + "'");&lt;/P&gt;&lt;P&gt;&amp;nbsp; conn = DriverManager.getConnection("jdbc:sharenet://w33284:9453/", props);&lt;/P&gt;&lt;P&gt;&amp;nbsp; stmt = conn.createStatement();&lt;/P&gt;&lt;P&gt;&amp;nbsp; ResultSet rs = stmt.executeQuery("select * from " + "x.Datoer");&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (rs.next()) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date datof = rs.getDate("datof");&lt;/P&gt;&lt;P&gt;&amp;nbsp; long dato = rs.getLong("dato");&lt;/P&gt;&lt;P&gt;&amp;nbsp; System.out.println(datof+" "+dato);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; stmt.close();&lt;/P&gt;&lt;P&gt;&amp;nbsp; conn.close();&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; } catch (ClassNotFoundException | SQLException ex) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; Logger.getLogger(Testing_Datoer.class.getName()).log(Level.SEVERE, null, ex);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;1940-06-09 -7144&lt;/P&gt;&lt;P&gt;1940-06-10 -7143&lt;/P&gt;&lt;P&gt;1940-06-11 -7142&lt;/P&gt;&lt;P&gt;1940-06-12 -7141&lt;/P&gt;&lt;P&gt;1940-06-13 -7140&lt;/P&gt;&lt;P&gt;1940-06-15 -7139&lt;/P&gt;&lt;P&gt;1940-06-16 -7138&lt;/P&gt;&lt;P&gt;1940-06-17 -7137&lt;/P&gt;&lt;P&gt;1940-06-18 -7136&lt;/P&gt;&lt;P&gt;1940-06-19 -7135&lt;/P&gt;&lt;P&gt;1940-06-20 -7134&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As seen the date 1940-06-14 is missing and the first 5 dates are wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running Win 7 + SAS 9.2 + Java 1.8. The problem occurs with JDBC 9.1/9.2/9.3/9.4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is going on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jesper&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 08:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199439#M4382</guid>
      <dc:creator>jespersahner</dc:creator>
      <dc:date>2015-04-19T08:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199440#M4383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since I could verify that the dataset is created correctly both on AIX and Win7, I suggest to open a track with SAS TS. The error could happen in the SAS JDBC driver, after all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 06:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199440#M4383</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-04-20T06:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199441#M4384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works for me. I'm using SAS 9.4 M0 with an IOM based JDBC connection rather than SAS/SHARE and I get a continuous sequence of dates including 14Jun1940.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Off the top of my head, I'm wondering if it might be a daylight savings time (DST) interaction where a day increment plus a time change ticks the other side of midnight and loses a date. &lt;SPAN style="font-size: 13.3333330154419px;"&gt;What time zone are you in? I'm in GMT+10 with no DST. &lt;/SPAN&gt;You're setting a day value in the SAS code but the JDBC getDate() method is returning a date &amp;amp; time and so time and DST may be a factor here perhaps? Interestingly, I read that there were significant differences in DST during the 2nd world war - the UK was in British Double Summer Time (BDST) from 1940-1945 for example: &lt;A href="http://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation" title="http://en.wikipedia.org/wiki/British_Summer_Time#Periods_of_deviation"&gt;British Summer Time - Wikipedia, the free encyclopedia&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 08:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199441#M4384</guid>
      <dc:creator>PaulHomes</dc:creator>
      <dc:date>2015-04-20T08:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199442#M4385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for you input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am in GMT+1 with DST (Copenhagen).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem seems to arise beginning with year 1900:&lt;/P&gt;&lt;P&gt;1899-12-27 -21919&lt;/P&gt;&lt;P&gt;1899-12-28 -21918&lt;/P&gt;&lt;P&gt;1899-12-29 -21917&lt;/P&gt;&lt;P&gt;1899-12-30 -21916&lt;/P&gt;&lt;P&gt;1899-12-31 -21915&lt;/P&gt;&lt;P&gt;1900-01-01 -21914&lt;/P&gt;&lt;P&gt;1900-01-01 -21913&lt;/P&gt;&lt;P&gt;1900-01-02 -21912&lt;/P&gt;&lt;P&gt;1900-01-03 -21911&lt;/P&gt;&lt;P&gt;1900-01-04 -21910&lt;/P&gt;&lt;P&gt;1900-01-05 -21909&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that 1900-01-01 is repeated. This 1 day lack is then retained until 1940-06-15.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am able to fix the problem by adding a Calendar:&lt;/P&gt;&lt;P&gt;Date datof = rs.getDate("datof", Calendar.getInstance());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the behaviour is still very strange and I will open a track with SAS Technical Support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jesper&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 09:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199442#M4385</guid>
      <dc:creator>jespersahner</dc:creator>
      <dc:date>2015-04-20T09:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199443#M4386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another way to test this is by using a "standard" application that could read the data directly from the JDBC driver.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2015 08:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199443#M4386</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-04-21T08:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199444#M4387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Variables dato and datof are actually the same number in your SAS dataset. I believe the issue is in the "Date datof = rs.getDate("datof");" statement, although I hesitate to call it a bug since adding the calendar fixes it. I don't see any way this is involved with SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that if you switch the statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date datof = rs.getDate("dato");&lt;/P&gt;&lt;P&gt;&amp;nbsp; long dato = rs.getLong("datof");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you'll see the same problem in the output datof, even though it's coming from a different variable. Beyond that, my knowledge of Java is too sparse to suggest anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2015 13:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199444#M4387</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-04-21T13:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199445#M4388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, dato and datof are (deliberately) the same number, which shows that the JDBC driver causes the problem.&lt;/P&gt;&lt;P&gt;You can not switch the statements, since "dato" can not be converted to Date and "datof" can not be converted to long, the JDBC driver prevents this as it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS Technical Support has been able to reproduce the problem so I expect them to fix the JDBC driver.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2015 16:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199445#M4388</guid>
      <dc:creator>jespersahner</dc:creator>
      <dc:date>2015-04-21T16:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199446#M4389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure . You should set you Time Zone to Date Class . I remember I wrote some Java code before to get wrong Date if your Time Zone is not set right .&lt;/P&gt;&lt;P&gt;And Did you check StackOverFlow.com to ask how to get Java Date ? I used to go there to get some Java help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2015 12:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199446#M4389</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-04-22T12:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199447#M4390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I change the time zone to UTC-06:00 Central America, no DST observed I get this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1899-12-29 -21917&lt;/P&gt;&lt;P&gt;1899-12-30 -21916&lt;/P&gt;&lt;P&gt;1899-12-31 -21915&lt;/P&gt;&lt;P&gt;1899-12-31 -21914&lt;/P&gt;&lt;P&gt;1900-01-01 -21913&lt;/P&gt;&lt;P&gt;1900-01-02 -21912&lt;/P&gt;&lt;P&gt;1900-01-03 -21911&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1960-04-21 112&lt;/P&gt;&lt;P&gt;1960-04-22 113&lt;/P&gt;&lt;P&gt;1960-04-23 114&lt;/P&gt;&lt;P&gt;1960-04-25 115&lt;/P&gt;&lt;P&gt;1960-04-26 116&lt;/P&gt;&lt;P&gt;1960-04-27 117&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here 1899-12-31 is repeated and now 1960-04-24 is missing, can you reproduce this by change the time zone?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 May 2015 04:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199447#M4390</guid>
      <dc:creator>jespersahner</dc:creator>
      <dc:date>2015-05-09T04:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong date using Java/JDBC (1940-06-14 is missing)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199448#M4391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem has now been reproduced by SAS Global Support and a track has been opened.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jesper&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 16:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Wrong-date-using-Java-JDBC-1940-06-14-is-missing/m-p/199448#M4391</guid>
      <dc:creator>jespersahner</dc:creator>
      <dc:date>2015-05-14T16:09:47Z</dc:date>
    </item>
  </channel>
</rss>

