<?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: How to use IOM provider to read Date values into a .NET  application in an efficient way in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/743509#M232808</link>
    <description>&lt;P&gt;Once I got the recipe, making a transform from a SAS date value was easy.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A SAS datetime value is:&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;The number of seconds since 12:00 midnight on January 1, 1960.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;This value has to be mapped to a .NET DateTime value. This value is t&lt;SPAN&gt;he number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the Gregorian Calendar. A tick is&amp;nbsp;100 nanoseconds.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Here is the transform function written in C#:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   private DateTime SASBaseDate = new DateTime(1960, 01, 01);
   private const long TicksInASecond = 10000000;
   private DateTime ToDate(object sasTics) {
      if (sasTics == null || sasTics is DBNull)
         return DateTime.MinValue;
       var lTicks = Convert.ToInt64(sasTics);
       return new DateTime(SASBaseDate.Ticks + (lTicks * TicksInASecond));
   }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 09:38:26 GMT</pubDate>
    <dc:creator>ReidarDMidtun</dc:creator>
    <dc:date>2021-05-25T09:38:26Z</dc:date>
    <item>
      <title>How to use IOM provider to read Date values into a .NET  application in an efficient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/742355#M232186</link>
      <description>&lt;P&gt;I am using the IOM provider to read data from a SAS Base library into a .NET C# application. The problem arises when reading columns defined as Date values. When reading unformatted objects, the date values are returned as double floating point numbers. I need a function to transform the number to a .NET DateTime object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I can instrument the IOM provider to return formatted string objects by setting&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ADODB.Recordset.Properties["SAS Formats"] = "_ALL_";&lt;/P&gt;&lt;P&gt;If I use this to have formatted objects returned, there is a performance degrade, it runs 100 times slower. Due to this I was hoping I could used unformatted objects and transform the number to DateTime objects in the .NET world. Is there a .NET library with SAS date functions that can do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See case&amp;nbsp;[SAS 7613337300] for more info.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 09:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/742355#M232186</guid>
      <dc:creator>ReidarDMidtun</dc:creator>
      <dc:date>2021-05-19T09:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IOM provider to read Date values into a .NET  application in an efficient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/742381#M232209</link>
      <description>&lt;P&gt;You might need to do this transformation yourself.&amp;nbsp; Here's &lt;A href="https://blogs.sas.com/content/sasdummy/2012/06/14/read-a-microsoft-date-time-value-into-a-sas-date-time-value/" target="_self"&gt;an example for going the other way&lt;/A&gt; (Microsoft datetime to SAS).&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 12:00:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/742381#M232209</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2021-05-19T12:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IOM provider to read Date values into a .NET  application in an efficient way</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/743509#M232808</link>
      <description>&lt;P&gt;Once I got the recipe, making a transform from a SAS date value was easy.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A SAS datetime value is:&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;The number of seconds since 12:00 midnight on January 1, 1960.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;This value has to be mapped to a .NET DateTime value. This value is t&lt;SPAN&gt;he number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the Gregorian Calendar. A tick is&amp;nbsp;100 nanoseconds.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Here is the transform function written in C#:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   private DateTime SASBaseDate = new DateTime(1960, 01, 01);
   private const long TicksInASecond = 10000000;
   private DateTime ToDate(object sasTics) {
      if (sasTics == null || sasTics is DBNull)
         return DateTime.MinValue;
       var lTicks = Convert.ToInt64(sasTics);
       return new DateTime(SASBaseDate.Ticks + (lTicks * TicksInASecond));
   }&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 09:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-IOM-provider-to-read-Date-values-into-a-NET/m-p/743509#M232808</guid>
      <dc:creator>ReidarDMidtun</dc:creator>
      <dc:date>2021-05-25T09:38:26Z</dc:date>
    </item>
  </channel>
</rss>

