<?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: Date in Variable Appearing as Number in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138432#M9729</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian, try with simple quotes to avoid the division (02 divided by 25 divided by 2017) :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Date('$(vDateDefaultFrom)')&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Oct 2018 16:24:34 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2018-10-25T16:24:34Z</dc:date>
    <item>
      <title>Date in Variable Appearing as Number</title>
      <link>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138431#M9728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In &lt;STRONG style="text-decoration: underline;"&gt;QlikSense&lt;/STRONG&gt; I have a variable in the loadscript that defines a default date:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDateDefaultFrom = Date(Addmonths(Now(),-20),'MM/DD/YYYY');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variable value appears correctly as 02/25/2017 in the variable window but when I add it to a text object or KPI it is appearing as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.9662865642043e-05&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I wrap the variable in a Date() it is returning an incorrect date:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date($(vDateDefaultFrom)) = 12/30/1899&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do we know why this is happening?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 15:52:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138431#M9728</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-25T15:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date in Variable Appearing as Number</title>
      <link>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138432#M9729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian, try with simple quotes to avoid the division (02 divided by 25 divided by 2017) :&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Date('$(vDateDefaultFrom)')&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:24:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138432#M9729</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2018-10-25T16:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Date in Variable Appearing as Number</title>
      <link>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138433#M9730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be leave it as a number in the script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vDateDefaultFrom = Num(Floor(Addmonths(Now(), -20)));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then use Date() on the front end&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:25:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138433#M9730</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-10-25T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Date in Variable Appearing as Number</title>
      <link>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138434#M9731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the suggestions.&amp;nbsp; I just took the variable out of the QVS and created it directly in the app.&amp;nbsp; Not sure how this will affect performance but at least it is correctly appearing as a date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;: Spoke too soon.&amp;nbsp; Putting the variable in the app works as long as I do not put an '=' in front of the expression.&amp;nbsp; In addition, another variable I created is not formatting dates correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(COUNT([Transaction Month])=COUNT({&amp;lt;[Transaction Month]=&amp;gt;}[Transaction Month]),$(vDateDefaultFrom),MIN(TranDateTime))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When it returns $(vDateDefaultFrom) it is correctly formatted as 02/25/2017.&amp;nbsp; When it returns MIN(TranDateTime) I am getting 41762.668055556.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I create a text box with MIN(TranDateTime) it correctly displays as 05/03/2014 4:02:00PM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggling to understand the point of variables if these issues occur.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:34:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138434#M9731</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-25T16:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Date in Variable Appearing as Number</title>
      <link>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138435#M9732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Final attempt appears to be working correctly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(ISNULL(GetFieldSelections([Transaction Month])),Date(Addmonths(Today(),-20),'MM/DD/YYYY'),DATE(MIN(TranDateTime)))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 16:49:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-in-Variable-Appearing-as-Number/m-p/138435#M9732</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-25T16:49:37Z</dc:date>
    </item>
  </channel>
</rss>

