<?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 variable showing incorrect date after script loaded in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039249#M642254</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET DateFormat='MM-DD-YYYY';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vAnnualizedDate = Date('01-02-2016', 'MM-DD-YYYY');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/112128_Capture.PNG" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jan 2016 16:11:14 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-01-20T16:11:14Z</dc:date>
    <item>
      <title>Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039245#M642250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to create a dynamic formula to subtract two dates and get the number of days between them. One date is static, and one is the current date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried just subtracting them and that gives me a number over 40,000. Which is incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now I am trying to create the dates in the load script as variables and just subtract the variables. It looked like it was working,&amp;nbsp; but when I looked at the Variable in the Settings-&amp;gt;Variable Overview, it showed a completely different date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code in my script.&lt;/P&gt;&lt;PRE __default_attr="html" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14533049378448118 jive_text_macro" jivemacro_uid="_14533049378448118"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;Let&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;vCurrentTodayDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(0), 'MM-DD-YYYY');&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;vAnnualizedDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(01-02-2016, 'MM-DD-YYYY'); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;In the variable overview, it has the correct date of today for the first variable (01-20-2016)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;But the second variable is showing another date then the one entered in the script (06-22-1894) I'm not sure why it's showing me a number from 1894?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 15:55:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039245#M642250</guid>
      <dc:creator>crystles</dc:creator>
      <dc:date>2016-01-20T15:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039246#M642251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be put the date within single quotes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Let&lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"&gt; vAnnualizedDate = Date&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;&lt;STRONG&gt;(&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;01-02-2016&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;, 'MM-DD-YYYY');&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 15:56:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039246#M642251</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-20T15:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039247#M642252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-users/171708"&gt;sunindia&lt;/A&gt;‌&amp;nbsp; small correction ('#' is missing)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Let&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt; vAnnualizedDate = &lt;SPAN style="color: #ff6600;"&gt;Date#&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #ff0000;"&gt;'&lt;/SPAN&gt;01-02-2016&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #ff0000;"&gt;'&lt;/SPAN&gt;, 'MM-DD-YYYY');&amp;nbsp; &lt;/STRONG&gt;//This will give date number&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;Let&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt; vAnnualizedDate = Date(&lt;SPAN style="color: #ff6600;"&gt;Date#&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #ff0000;"&gt;'&lt;/SPAN&gt;01-02-2016&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #ff0000;"&gt;'&lt;/SPAN&gt;, 'MM-DD-YYYY')); &lt;/STRONG&gt;//This will give date&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:05:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039247#M642252</guid>
      <dc:creator>settu_periasamy</dc:creator>
      <dc:date>2016-01-20T16:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039248#M642253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wouldn't Date#() depend on the fact what is used in the SET DateFormat?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is set as MM-DD-YYYY, the wouldn't it automatically read it '01-02-2016 as date? I was the under the impression it would, but I might be wrong here &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am going to test it now&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:08:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039248#M642253</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-20T16:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039249#M642254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET DateFormat='MM-DD-YYYY';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET vAnnualizedDate = Date('01-02-2016', 'MM-DD-YYYY');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/112128_Capture.PNG" style="height: auto;" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:11:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039249#M642254</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-20T16:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039250#M642255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the variable return 1894 means, there something missing on the variable. Because you didn't add the single quotes so it takes 1 as value for variable and return respective date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;Let&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; &lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM style="font-weight: inherit; font-size: 8pt; font-family: inherit; color: #808080;"&gt;vAnnualizedDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #0000ff;"&gt;Date&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 8pt; line-height: 1.5em;"&gt;&lt;STRONG&gt;01-02-2016'&lt;/STRONG&gt;, 'MM-DD-YYYY');&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:13:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039250#M642255</guid>
      <dc:creator />
      <dc:date>2016-01-20T16:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039251#M642258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Agreed. SET DateFormat doesn't came in my mind. sorry about that.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:18:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039251#M642258</guid>
      <dc:creator>settu_periasamy</dc:creator>
      <dc:date>2016-01-20T16:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039252#M642260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But you were right, I simply assumed the SET DateFormat to be MM-DD-YYYY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:20:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039252#M642260</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-20T16:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039253#M642263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for explaining why it was giving me such a strange date. That makes sense now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:21:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039253#M642263</guid>
      <dc:creator>crystles</dc:creator>
      <dc:date>2016-01-20T16:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039254#M642265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I knew it had to be something simple I was missing. I added the single quotes around my date and it worked perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:21:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039254#M642265</guid>
      <dc:creator>crystles</dc:creator>
      <dc:date>2016-01-20T16:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Date variable showing incorrect date after script loaded</title>
      <link>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039255#M642267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Glad we all were able to help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 16:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-variable-showing-incorrect-date-after-script-loaded/m-p/1039255#M642267</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-01-20T16:22:18Z</dc:date>
    </item>
  </channel>
</rss>

