<?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 Getting the year from a date variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193387#M54680</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have to use SET? If not, try following. It eliminates all the confusions of dollar sige, etc.&lt;/P&gt;&lt;P&gt;LET vStartYear = Year(vStartDate);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Sep 2009 23:28:47 GMT</pubDate>
    <dc:creator>disqr_rm</dc:creator>
    <dc:date>2009-09-21T23:28:47Z</dc:date>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193383#M54676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an input box containing a variable vStartDate. In the script I want to set another variable vStartYear which is just the year of vStartDate. However I'm having all kinds of trouble achieving what should be a really simple thing! In my script I have the following:&lt;/P&gt;&lt;P&gt;SET vStartYear = Year($(vStartDate));&lt;/P&gt;&lt;P&gt;But if I trace it, it seems to convert it to the string "Year(01/01/2007)". I have tried using the Date function but this also appears as a string. I have also tried various other things, the "best" I've managed is for it to be set to 1899. What am I doing wrong? It's driving me crazy!&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:01:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193383#M54676</guid>
      <dc:creator />
      <dc:date>2009-09-21T23:01:59Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193384#M54677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it would seem that the format in which your vStartDate variable is being typed into the input box is not being recognized by QV as a timestamp. For example this works correctly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set CurrentDate=Today(2);&lt;BR /&gt;Set CurrentYear=Year($(CurrentDate));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:14:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193384#M54677</guid>
      <dc:creator />
      <dc:date>2009-09-21T23:14:10Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193385#M54678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;SET vStartYear = Year('$(=vStartDate)');&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Dates can sometimes do funny things on the dollar sign expansion. You may not need an equals sign and the single quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:19:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193385#M54678</guid>
      <dc:creator />
      <dc:date>2009-09-21T23:19:42Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193386#M54679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following:&lt;/P&gt;&lt;P&gt;Let vStarYear = Year($(vStarDate))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:25:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193386#M54679</guid>
      <dc:creator>GabrielAraya</dc:creator>
      <dc:date>2009-09-21T23:25:16Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193387#M54680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have to use SET? If not, try following. It eliminates all the confusions of dollar sige, etc.&lt;/P&gt;&lt;P&gt;LET vStartYear = Year(vStartDate);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:28:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193387#M54680</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2009-09-21T23:28:47Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193388#M54681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rakesh, I didn't realise you could use LET and specify variables like that. I'm now getting 1899 as the answer, with my input box containing 01/01/2007. If I add the following line:&lt;/P&gt;&lt;P&gt;LET vStartDate1 = Date(vStartDate,'DD/MM/YYYY')&lt;/P&gt;&lt;P&gt;and reload in debug mode, I can see that vStartDate1 is 30/12/1899. So the problem does appear to be with the input box. How do I get that to recognise that it's a date?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:43:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193388#M54681</guid>
      <dc:creator />
      <dc:date>2009-09-21T23:43:49Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193389#M54682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you need to change the variables, i.e. LET vStartDate = Date(Year(AnotherDateField), 'DD/MM/YYYY');&lt;BR /&gt;Currently you have determined the date-value of an empty variable, vStartDate.&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:49:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193389#M54682</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2009-09-21T23:49:05Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193390#M54683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand. See enclosed. It's working fine for me. Can you attach a sample here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2009 23:54:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193390#M54683</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2009-09-21T23:54:18Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193391#M54684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I've fixed it by going to Document Properties, Variables, setting the constraints of vStartDate to Custom and making the custom expression date#. In the debugger, vStartDate now displays as 01/01/07 and vStartYear as 2007. Thanks for putting me on the right track.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 00:00:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193391#M54684</guid>
      <dc:creator />
      <dc:date>2009-09-22T00:00:36Z</dc:date>
    </item>
    <item>
      <title>Getting the year from a date variable</title>
      <link>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193392#M54685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paul, thanks for your feedback. Glad that it's fixed now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2009 00:06:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Getting-the-year-from-a-date-variable/m-p/193392#M54685</guid>
      <dc:creator>disqr_rm</dc:creator>
      <dc:date>2009-09-22T00:06:43Z</dc:date>
    </item>
  </channel>
</rss>

