<?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: Calculate difference between two dates? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074526#M635585</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;timestamp(close date-opendate) as difference time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 May 2016 14:25:50 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-05-04T14:25:50Z</dc:date>
    <item>
      <title>Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074523#M635582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;I have two date fields, &lt;SPAN style="font-size: 13.3333px;"&gt;I have to calculate the difference in hours.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; viz., open date and close date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Open_Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Close_Date&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;10/01/2016 08:20:00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12/01/2016 9:50:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used timestamp for both the columns and on the result also. &lt;/P&gt;&lt;P&gt;Eg: &lt;SPAN style="font-size: 13.3333px;"&gt;timestamp(&lt;SPAN style="font-size: 13.3333px;"&gt;Close_Date&lt;/SPAN&gt;) - &lt;/SPAN&gt;timestamp(&lt;SPAN style="font-size: 13.3333px;"&gt;Open_Date &lt;/SPAN&gt;)&amp;nbsp; as Cycletime &lt;/P&gt;&lt;P&gt;Now i am getting the time in hours and minutes as below.&lt;/P&gt;&lt;P&gt;Eg: difference between abve dates is 49:30:00.&lt;/P&gt;&lt;P&gt;What I am expecting is like 49.50 hours(I have to calculate that 30 minutes into hours then add that to the 49 hours) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;Prashanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 14:06:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074523#M635582</guid>
      <dc:creator />
      <dc:date>2016-05-04T14:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074524#M635583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;=round( (frac(timestamp(closedate))- frac(timestamp(opendate)))*24,0.01)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 14:12:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074524#M635583</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2016-05-04T14:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074525#M635584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As far as I can see,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Round( (Close_Date - Open_Date)*24, 0.01) AS CycleTime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should be enough&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 14:23:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074525#M635584</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-04T14:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074526#M635585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;timestamp(close date-opendate) as difference time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 14:25:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074526#M635585</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-04T14:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074527#M635586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sweuhl,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the result is in minutes or hours.. I am getting wrong values??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 15:34:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074527#M635586</guid>
      <dc:creator />
      <dc:date>2016-05-04T15:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074528#M635587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kushal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;negative values are getting when i use the above expression..?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 15:40:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074528#M635587</guid>
      <dc:creator />
      <dc:date>2016-05-04T15:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074529#M635588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sweuhl , am I clear with my requirement ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 15:42:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074529#M635588</guid>
      <dc:creator />
      <dc:date>2016-05-04T15:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074530#M635589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could this work? &lt;/P&gt;&lt;P&gt;Add a variable Close_Date and Open_Date in script&lt;/P&gt;&lt;P&gt;(DayNumberOfYear(Close_Date) - DayNumberOfYear((Open_Date)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And to get in hours:&lt;/P&gt;&lt;P&gt;(interval(num(Close_Date)-num(Open_Date),'hh'))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 16:00:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074530#M635589</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-04T16:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074531#M635590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. CycleTime should be in hours, with a fraction part as requested (0.5 equals 30 mins):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET TIMESTAMPFORMAT = 'DD/MM/YYYY hh:mm:ss';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Round( (Close_Date - Open_Date)*24, 0.01) AS CycleTime,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;timestamp(Close_Date - Open_Date) as differencetime;&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;Open_Date,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Close_Date&lt;/P&gt;&lt;P&gt;10/01/2016 08:20:00,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12/01/2016 9:50:00&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can't see that the suggested expression you've chosen as correct answer delivers 49.50, mine expression does:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE bgcolor="#ffffff" border="1" cellpadding="2" cellspacing="0" style="font-size: 9pt;"&gt;&lt;TBODY&gt;&lt;TR bgcolor="#f5f5f5"&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Open_Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;Close_Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;CycleTime&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;TH nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;&lt;STRONG&gt;differencetime&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR bgcolor="#ffffff"&gt;&lt;TD bgcolor="#ffffff" nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;10/01/2016 08:20:00&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff" nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;12/01/2016 9:50:00&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff"&gt;&lt;SPAN style="color: #363636;"&gt;49.50&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD bgcolor="#ffffff" nowrap="nowrap"&gt;&lt;SPAN style="color: #363636;"&gt;01/01/1900 01:30:00&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 16:46:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074531#M635590</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-05-04T16:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074532#M635591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand how this could be a correct answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 17:07:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074532#M635591</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2016-05-04T17:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074533#M635592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have used timestamp on two date columns and then subtracted, on result field again applied timstamp, &lt;/P&gt;&lt;P&gt;Its working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 18:40:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074533#M635592</guid>
      <dc:creator />
      <dc:date>2016-05-04T18:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between two dates?</title>
      <link>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074534#M635593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;working when i appiled the timestamp separately on the date columns.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2016 18:41:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculate-difference-between-two-dates/m-p/1074534#M635593</guid>
      <dc:creator />
      <dc:date>2016-05-04T18:41:22Z</dc:date>
    </item>
  </channel>
</rss>

