<?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. :Subtract two date fields to get time difference in minutes. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237549#M88602</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. But it didn't work out for me. I tried :&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;B&gt;interval&lt;/B&gt;('1899-12-30 1:10:00 PM'-'1899-12-30 9:10:00 AM', 'mm')&lt;/P&gt;&lt;P&gt;It gives a '-' i.e null as result.&lt;/P&gt;&lt;P&gt;The 'tt' i.e AM/PM here seems to be the problem. How do I get rid of the 'tt' part, because the date is stored in SQL in that particular format I mentioned earlier. Do I need to truncate the 'tt' part from the date string? But how would it know what time period it is subtracting 'AM/PM'? Really confused on this part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following expression seems to work absolutely fine giving result as 240 minutes:&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;B&gt;interval&lt;/B&gt;('1:10:00 PM'-'9:10:00 AM', 'mm')&lt;/P&gt;&lt;P&gt;So the time part needs to be retrieved from the date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Jul 2010 05:27:50 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-07-30T05:27:50Z</dc:date>
    <item>
      <title>Subtract two date fields to get time difference in minutes.</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237547#M88600</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 date's stored in a SQL database, the field type being datetime. Date is stored in the 'YYYY-MM-DD hh:mm:ss tt' format.&lt;/P&gt;&lt;P&gt;tt being AM / PM.&lt;/P&gt;&lt;P&gt;I need to retrieve only the time part out of this date. i.e Time(StopDate) - Time(StartDate)=Time in minutes.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;StopDate: 1899-12-30 1:10:00 PM&lt;/P&gt;&lt;P&gt;StartDate: 1899-12-30 9:14:00 AM&lt;/P&gt;&lt;P&gt;So I need something like : 1:10:00 PM - 9:14:00 AM = 236 minutes.&lt;/P&gt;&lt;P&gt;Any suggestions on how this can be done?&lt;/P&gt;&lt;P&gt;Secondly, how to get a count of NULL values of a datetime field? I tried something like : if(isnull(Date),nullcount(Date)). But this returns slightly different values as compared to a similar query written in SQL.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 13:28:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237547#M88600</guid>
      <dc:creator />
      <dc:date>2010-07-29T13:28:29Z</dc:date>
    </item>
    <item>
      <title>Re. :Subtract two date fields to get time difference in minutes.</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237548#M88601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;interval(StopDate-StartDate,'mm')&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Hope it helps you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 14:21:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237548#M88601</guid>
      <dc:creator>martin59</dc:creator>
      <dc:date>2010-07-29T14:21:56Z</dc:date>
    </item>
    <item>
      <title>Re. :Subtract two date fields to get time difference in minutes.</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237549#M88602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply. But it didn't work out for me. I tried :&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;B&gt;interval&lt;/B&gt;('1899-12-30 1:10:00 PM'-'1899-12-30 9:10:00 AM', 'mm')&lt;/P&gt;&lt;P&gt;It gives a '-' i.e null as result.&lt;/P&gt;&lt;P&gt;The 'tt' i.e AM/PM here seems to be the problem. How do I get rid of the 'tt' part, because the date is stored in SQL in that particular format I mentioned earlier. Do I need to truncate the 'tt' part from the date string? But how would it know what time period it is subtracting 'AM/PM'? Really confused on this part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following expression seems to work absolutely fine giving result as 240 minutes:&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;B&gt;interval&lt;/B&gt;('1:10:00 PM'-'9:10:00 AM', 'mm')&lt;/P&gt;&lt;P&gt;So the time part needs to be retrieved from the date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jul 2010 05:27:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237549#M88602</guid>
      <dc:creator />
      <dc:date>2010-07-30T05:27:50Z</dc:date>
    </item>
    <item>
      <title>Re. :Subtract two date fields to get time difference in minutes.</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237550#M88603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey I found out how that can be done:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=interval(Right('1899-12-30 12:09:00 PM',10)-Right('1899-12-30 8:33:00 AM',10),'mm')&lt;/P&gt;&lt;P&gt;But my second question is still pending. How to get a count of NULL values of a datetime field? I tried something like : if(isnull(Date),nullcount(Date)). But this returns slightly different values as compared to a similar query written in SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jul 2010 05:58:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-two-date-fields-to-get-time-difference-in-minutes/m-p/237550#M88603</guid>
      <dc:creator />
      <dc:date>2010-07-30T05:58:05Z</dc:date>
    </item>
  </channel>
</rss>

