<?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 get proper date value from a number? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369939#M1172399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there should be something more elegant to get the correct date from your MS SQL server, but if you only get a number back, you need to subtract the difference in days of the calendar origins (30.12.1899 - 28.12.1800), which is&lt;/P&gt;&lt;P&gt;36161.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, try subtracting this number from your date field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=date(77070-36161)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Date(DATEFIELD - 36161) as Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM ...;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jul 2012 15:35:42 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2012-07-27T15:35:42Z</dc:date>
    <item>
      <title>How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369934#M1172394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I'm new to QlikView.&lt;/P&gt;&lt;P&gt;I have got my data in MS SQL database.&lt;/P&gt;&lt;P&gt;The DateX column is stored as the number of days since 28/12/1800.&lt;/P&gt;&lt;P&gt;To questions:&lt;/P&gt;&lt;P&gt;1. How to get to the proper date value in QlikView for a number 77070 (I know it should be 01/01/2012.&lt;/P&gt;&lt;P&gt;2. Is it possible to use in QlikView script MS SQL Scalar-valued function which does the conversion to proper date. (Function takes the DateX column as an argument&amp;nbsp; and returns varchar(10) string).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your contribution.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 14:31:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369934#M1172394</guid>
      <dc:creator />
      <dc:date>2012-07-26T14:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369935#M1172395</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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =Date(77070,'DD/MM/YYYY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 14:39:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369935#M1172395</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2012-07-26T14:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369936#M1172396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mayil&lt;/P&gt;&lt;P&gt;When I have used it in QV script as SQL Select element I have got an error:&lt;/P&gt;&lt;P&gt;ErrorSource: Microsoft OLE DB Provider for SQL Server, ErrorMsg: 'Date' is not a recognized built-in function name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More ideas?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 15:05:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369936#M1172396</guid>
      <dc:creator />
      <dc:date>2012-07-26T15:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369937#M1172397</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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load *, Date(FieldName,'DD/MM/YYYY') as DateField;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select * from TableName;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jul 2012 16:17:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369937#M1172397</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2012-07-26T16:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369938#M1172398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No sccess.&lt;/P&gt;&lt;P&gt;Instead giving me date 01/06/2012 it gives me 04/06/2111.&lt;/P&gt;&lt;P&gt;That means Date functions works somehow, but not as I expect.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2012 15:03:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369938#M1172398</guid>
      <dc:creator />
      <dc:date>2012-07-27T15:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369939#M1172399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think there should be something more elegant to get the correct date from your MS SQL server, but if you only get a number back, you need to subtract the difference in days of the calendar origins (30.12.1899 - 28.12.1800), which is&lt;/P&gt;&lt;P&gt;36161.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, try subtracting this number from your date field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=date(77070-36161)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;resp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Date(DATEFIELD - 36161) as Date,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;...&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM ...;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2012 15:35:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369939#M1172399</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-07-27T15:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get proper date value from a number?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369940#M1172400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Swuehl!&lt;/P&gt;&lt;P&gt;And your elegant way works great.&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm still looking for an answer for the second question:&lt;/P&gt;&lt;P&gt; Is it possible to use MS SQL Scalar-valued function in QlikView script? If yes, how to do it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2012 15:16:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-proper-date-value-from-a-number/m-p/369940#M1172400</guid>
      <dc:creator />
      <dc:date>2012-07-30T15:16:31Z</dc:date>
    </item>
  </channel>
</rss>

