<?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: difference between date type values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438086#M490630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=date(date#('1002171051', 'YYMMDDhhmm'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Sep 2012 12:44:30 GMT</pubDate>
    <dc:creator>jagan</dc:creator>
    <dc:date>2012-09-25T12:44:30Z</dc:date>
    <item>
      <title>difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438081#M490625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have date-time data coming in from sql server in the form of integar &lt;/P&gt;&lt;P&gt;ex:&amp;nbsp; one column 'abc' contains values such as :&amp;nbsp; 1002171551 (date value in: yymmddhhmm)&lt;/P&gt;&lt;P&gt;2nd column 'def' contains values such as : 100217 or 1002170000 (date value in: yymmdd) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i need to calculate difference between these two columns and i want sql server to treat these as date columns and not integar ones.&lt;/P&gt;&lt;P&gt;right now when i do the difference i get result purely as in subtraction of 2 integar values. but i want the result to be calculated as a difference between dates.s&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any suggestions?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 11:55:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438081#M490625</guid>
      <dc:creator />
      <dc:date>2012-09-25T11:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438082#M490626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Tushar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First in QV scripting convert the date values in the form of numbers to date by using Date# function, so now the values are in date format now you can calculate the difference using Interval() easily.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;Date#( DateField, 'YYMMDD' )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;Hope this helps you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;Jagan.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 12:17:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438082#M490626</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-09-25T12:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438083#M490627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi jagan, thanks for the answer. &lt;/P&gt;&lt;P&gt;but the problem is that these number values are actually dates (1002171551 - '10' as year, '02' as month, '17' as date, '15' as hour, '51' as minutes) in sql. so if i use date# on these, result will be wrong data. hope it makes sense. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-tushar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 12:20:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438083#M490627</guid>
      <dc:creator />
      <dc:date>2012-09-25T12:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438084#M490628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date#() should not be used in SQL query, it should be used in Qlikview Load statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 12:24:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438084#M490628</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-09-25T12:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438085#M490629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, &lt;/P&gt;&lt;P&gt;i have used it in QV scripts and like i said before, it does not treat it differently. &lt;/P&gt;&lt;P&gt;here's an example:&amp;nbsp; date#('1002171551', 'YYMMDD') gives output as 1002171551.&lt;/P&gt;&lt;P&gt;and if i calculate difference between two columns containing this type of data, i dont get the output at all&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 12:32:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438085#M490629</guid>
      <dc:creator />
      <dc:date>2012-09-25T12:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438086#M490630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=date(date#('1002171051', 'YYMMDDhhmm'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 12:44:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438086#M490630</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-09-25T12:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438087#M490631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this partially helps. but what i need to find is the difference between two columns that contain data like this.&lt;/P&gt;&lt;P&gt;say col abc = 1002171551&lt;/P&gt;&lt;P&gt;col def = 1002171051&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now 'abc' - 'def' should be calculated as difference between calendar dates and the result should be displayed in calendar date format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 12:56:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438087#M490631</guid>
      <dc:creator />
      <dc:date>2012-09-25T12:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438088#M490632</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;thanks for your suggestion, and i mixed interval() with timestamp#() to get the desired result, just not in the desired format. still working on it.. thanks Jagan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 13:04:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438088#M490632</guid>
      <dc:creator />
      <dc:date>2012-09-25T13:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438089#M490633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You will get difference between two dates in terms of days/months/years, I cannot understand what you are asking "difference between calendar dates and the result should be displayed in calendar date format.".&amp;nbsp; Please clarify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Sep 2012 13:13:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438089#M490633</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2012-09-25T13:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438090#M490634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;date#('1002171551', 'YYMMDD') gives output as 1002171551.&lt;/P&gt;&lt;P&gt;and if i calculate difference between two columns containing this type of data&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;To use date#() here you should &lt;SPAN style="text-decoration: underline;"&gt;truncate&lt;/SPAN&gt; your string (it's a known issue):&lt;/P&gt;&lt;P&gt;date#(left('1002171551', 6), 'YYMMDD')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To check that your string dates was converted into numerical dates (so that you can add and subtract them), you can just try to change its text format. For example, using num() functiont that return numerical representation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can easily try it in a text box:&lt;/P&gt;&lt;P&gt;=num(date#(left('1002171551', 6), 'YYMMDD')) &amp;lt;&amp;lt; this returns 40226&lt;/P&gt;&lt;P&gt;=num(date#('1002171551', 'YYMMDD')) &amp;lt;&amp;lt; this doesn't work and returns null.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 07:09:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438090#M490634</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-27T07:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: difference between date type values</title>
      <link>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438091#M490635</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;Based on your example, I loaded it inline, used the makedate function to get the proper date format. Now you can compute for the date difference. See the attached file for your reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Janzen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2012 08:34:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/difference-between-date-type-values/m-p/438091#M490635</guid>
      <dc:creator />
      <dc:date>2012-09-27T08:34:56Z</dc:date>
    </item>
  </channel>
</rss>

