<?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: String Date YYYYMMDD &amp;gt; Epoch date comparison in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507437#M690730</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your help.&amp;nbsp; I have tried your suggestions but unfortunately still cannot get the comparison to work.&amp;nbsp; At present, this is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vTwoWeeksAgo='';&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;LET vTwoWeeksAgo=Date(Today()-14,'YYYYMMDD');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;TEST:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;DATE#(PDDCR,'YYYYMMDD') AS DATECREATED&lt;/P&gt;&lt;P&gt;FROM TABLE_A;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEST2:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;RESIDENT TEST&lt;/P&gt;&lt;P&gt;WHERE DATECREATED &amp;gt; $(vTwoWeeksAgo);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Oct 2013 14:23:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-10-03T14:23:55Z</dc:date>
    <item>
      <title>String Date YYYYMMDD &gt; Epoch date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507434#M690727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello my QV friends.&amp;nbsp; I have been stuck on a problem for a couple of days now and just cannot figure out how to resolve the issue.&amp;nbsp; I am going to try to be as specific as possible.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a variable named vTwoWeeksAgo.&amp;nbsp; It calculates today's date minus 14 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13808053530123759" jivemacro_uid="_13808053530123759" modifiedtitle="true"&gt;
&lt;P&gt;SET vTwoWeeksAgo='';&lt;/P&gt;
&lt;P&gt;LET vTwoWeeksAgo=D&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;ate(Today()-14);&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then use a LOAD statement that has the following field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13808058878172467" jivemacro_uid="_13808058878172467" modifiedtitle="true"&gt;
&lt;P&gt;LOAD &lt;/P&gt;
&lt;P&gt;DATE(DATE#(PDDCR, 'YYYYMMDD'), 'MM/DD/YYYY') AS DATECREATED,&lt;/P&gt;
&lt;P&gt;FROM TABLE_A;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in another LOAD statement I am trying to do the comparison:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13808062337122069" jivemacro_uid="_13808062337122069" modifiedtitle="true"&gt;
&lt;P&gt;LOAD *&lt;/P&gt;
&lt;P&gt;RESIDENT TABLE_A&lt;/P&gt;
&lt;P&gt;WHERE DATECREATED &amp;gt; $(vTwoWeeksAgo);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I "think" the problem is that I have two different types of dates.&amp;nbsp; My DateCreated field has the dates formatted first as YYYYMMDD, which I have converted to MM/DD/YYYY.&amp;nbsp; I then want to be able to find records that have this date greater than my variable.&amp;nbsp; However, I think my variable is being represented as the epoch date, a five digit date.&amp;nbsp; Please, what am I doing wrong?&amp;nbsp; Thanks so much &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 13:22:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507434#M690727</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-10-03T13:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: String Date YYYYMMDD &gt; Epoch date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507435#M690728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to Create the&amp;nbsp; vTwoWeeksAgo format same as &lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f8f8f8;"&gt;PDDCR&lt;/SPAN&gt; field (YYYYMMDD)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like&lt;/P&gt;&lt;P&gt;LET vTwoWeeksAgo=Date(Today()-14,'YYYYMMDD'); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mukram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 13:34:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507435#M690728</guid>
      <dc:creator>mdmukramali</dc:creator>
      <dc:date>2013-10-03T13:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: String Date YYYYMMDD &gt; Epoch date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507436#M690729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One 'tricky' thing in QlikView is the fact that a date field is dual (its a numerics formatted acoording to a format), but a variable is &lt;STRONG&gt;not&lt;/STRONG&gt; dual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, when you do &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;LET vTwoWeeksAgo=Date(Today()-14,'YYYYMMDD');&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;vTwoWeeksAgo is a string, correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it when you use that string you have to take care of this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I do comparisons I always format to a 'string-like comparision' &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;'YYYYMMDD'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;I would rewrite your code to:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class="dp-c" start="1" style="font-size: 12.222222328186035px; font-family: Consolas, 'Courier New', Courier, mono, serif; list-style-position: initial; list-style-image: initial; color: #5c5c5c; margin-bottom: 1px !important; margin-left: 45px !important;"&gt;&lt;LI&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;LET vTwoWeeksAgo=Date(Today()-14,'YYYYMMDD');&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: black; font-size: 9pt !important; font-style: inherit; background-color: inherit;"&gt;LOAD *&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;RESIDENT TABLE_A&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="font-style: inherit; color: black; background-color: inherit; font-size: 9pt !important;"&gt;WHERE date(DATECREATED,'YYYYMMDD') &amp;gt; '$(vTwoWeeksAgo)';&amp;nbsp; &lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:02:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507436#M690729</guid>
      <dc:creator>Clever_Anjos</dc:creator>
      <dc:date>2013-10-03T14:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: String Date YYYYMMDD &gt; Epoch date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507437#M690730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your help.&amp;nbsp; I have tried your suggestions but unfortunately still cannot get the comparison to work.&amp;nbsp; At present, this is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vTwoWeeksAgo='';&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;LET vTwoWeeksAgo=Date(Today()-14,'YYYYMMDD');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;TEST:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;DATE#(PDDCR,'YYYYMMDD') AS DATECREATED&lt;/P&gt;&lt;P&gt;FROM TABLE_A;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TEST2:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;RESIDENT TEST&lt;/P&gt;&lt;P&gt;WHERE DATECREATED &amp;gt; $(vTwoWeeksAgo);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:23:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507437#M690730</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-10-03T14:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: String Date YYYYMMDD &gt; Epoch date comparison</title>
      <link>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507438#M690731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where possible, use number representation of dates, especially for comparisons. Leave text representation of dates only for UI objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f8f8f8;"&gt;LET vTwoWeeksAgo=num(Today()-14); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #f8f8f8;"&gt;...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f8f8f8; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;NUM(DATE#(PDDCR, 'YYYYMMDD')) AS DATECREATEDNUM,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f8f8f8; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 12px; background-color: #f8f8f8; font-family: Consolas, 'Courier New', Courier, mono, serif;"&gt;WHERE DATECREATEDNUM &amp;gt; $(vTwoWeeksAgo);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Oct 2013 14:33:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-Date-YYYYMMDD-gt-Epoch-date-comparison/m-p/507438#M690731</guid>
      <dc:creator />
      <dc:date>2013-10-03T14:33:38Z</dc:date>
    </item>
  </channel>
</rss>

