<?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: need help converting a date format in a Where clause in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550758#M39697</link>
    <description>&lt;P&gt;Try to use interpretation function when you load MinDate and MaxDate from your Excel file.&lt;/P&gt;&lt;PRE&gt;Temp:
Load
    Date(Min(Date#(ExcelDate,'DD/MM/YYYY hh:mm:ss TT')), 'YYYY-MM-DD') as MinDate
    ,Date(Max(Date#(ExcelDate,'DD/MM/YYYY hh:mm:ss TT')), 'YYYY-MM-DD') as MaxDate
Resident
    Excel_table
;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Feb 2019 20:34:05 GMT</pubDate>
    <dc:creator>sergio0592</dc:creator>
    <dc:date>2019-02-28T20:34:05Z</dc:date>
    <item>
      <title>need help converting a date format in a Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550751#M39696</link>
      <description>&lt;P&gt;My app's global variables are as follows:&lt;/P&gt;&lt;P&gt;TimeFormat:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;h:mm:ss TT&lt;/P&gt;&lt;P&gt;DateFormat:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M/D/YYYY&lt;/P&gt;&lt;P&gt;TimestampFormat:&amp;nbsp; &amp;nbsp;M/D/YYYY h:mm:ss[.fff] TT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data source (an Excel file) with dates like the following:&lt;/P&gt;&lt;P&gt;9/6/2018 3:50:36 PM&lt;/P&gt;&lt;P&gt;I have another data source (a SQL Server table) with dates like the following:&lt;/P&gt;&lt;P&gt;201-09-06&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SQL table is my date dimension table.&amp;nbsp; So, I want to filter its data to the range of dates from my Excel source.&amp;nbsp; So, I am doing the following:&lt;/P&gt;&lt;PRE&gt;Temp:
Load
&amp;nbsp; &amp;nbsp; Date(Min(ExcelDate), 'YYYY-MM-DD') as MinDate
&amp;nbsp; &amp;nbsp; ,Date(Max(ExcelDate), 'YYYY-MM-DD') as MaxDate
Resident
&amp;nbsp; &amp;nbsp; Excel_table
;

Let vDateMin = Peek('MinDate', 0, Temp);
Let vDateMax = Peek('MaxDate', 0, Temp);

Drop Table Temp;

dimension_date:
Load
&amp;nbsp; &amp;nbsp; SQLDate as ExcelDate
Where
&amp;nbsp; &amp;nbsp; SQLDate &amp;gt;= $(vDateMin) and SQLDate &amp;lt;= $(vDateMax)
;

SQL
SELECT
&amp;nbsp; &amp;nbsp; SQLDate
FROM
&amp;nbsp; &amp;nbsp; SQL_table
;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this is returning 0 rows into the dimension_date table.&amp;nbsp; How can I resolve this?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 21:30:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550751#M39696</guid>
      <dc:creator>skyline01</dc:creator>
      <dc:date>2021-12-21T21:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: need help converting a date format in a Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550758#M39697</link>
      <description>&lt;P&gt;Try to use interpretation function when you load MinDate and MaxDate from your Excel file.&lt;/P&gt;&lt;PRE&gt;Temp:
Load
    Date(Min(Date#(ExcelDate,'DD/MM/YYYY hh:mm:ss TT')), 'YYYY-MM-DD') as MinDate
    ,Date(Max(Date#(ExcelDate,'DD/MM/YYYY hh:mm:ss TT')), 'YYYY-MM-DD') as MaxDate
Resident
    Excel_table
;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 20:34:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550758#M39697</guid>
      <dc:creator>sergio0592</dc:creator>
      <dc:date>2019-02-28T20:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: need help converting a date format in a Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550763#M39698</link>
      <description>&lt;P&gt;I figured the solution to my problem.&amp;nbsp; The error is in my dollar-sign expansion.&amp;nbsp; The solution is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;dimension_date:
Load
    SQLDate as ExcelDate
Where
    SQLDate &amp;gt;= Date#('$(vDateMin)', 'YYYY-MM-DD') and SQLDate &amp;lt;= Date#('$(vDateMax)', 'YYYY-MM-DD')
;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Feb 2019 20:40:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/need-help-converting-a-date-format-in-a-Where-clause/m-p/1550763#M39698</guid>
      <dc:creator>skyline01</dc:creator>
      <dc:date>2019-02-28T20:40:47Z</dc:date>
    </item>
  </channel>
</rss>

