<?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/Time formatting in If statement in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615673#M45834</link>
    <description>&lt;P&gt;I did modify your solution a bit by using timestamp() vs date() because I need the time to be displayed.&amp;nbsp; Thank you for helping me.&lt;/P&gt;&lt;P&gt;Also, I changed it so the first value in the list of TimeZoneRegions was "- none -" and set that to force the default value to be equiv to SYS_CREATED_ON (since it kept trying to change the time by 2 hours even when no value was selected).&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;=if(TimeZoneRegions='- none -', timestamp(ConvertToLocalTime(SYS_CREATED_ON,'GMT')), timestamp(ConvertToLocalTime(SYS_CREATED_ON, '$(SelectedTimeZone)')))&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2019 21:39:56 GMT</pubDate>
    <dc:creator>Ruthie09</dc:creator>
    <dc:date>2019-08-22T21:39:56Z</dc:date>
    <item>
      <title>Date/Time formatting in If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615650#M45831</link>
      <description>&lt;P&gt;Please help.&amp;nbsp; I can't seem to get my table dates to appear in the proper format when using an "if" statment&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have table called TimeZones (which lists all the Qlik-compatible time zone locations).&lt;/LI&gt;&lt;LI&gt;I have a variable called SelectedTimeZone that uses the GetFieldSelections function to return the value selected by the user in a single-select filter called TimeZoneRegions.&lt;/LI&gt;&lt;LI&gt;I have a table of help desk tickets that, for testing purposes, contains the created date &amp;amp; time for each ticket (SYS_CREATED_ON) and a field called Modified Created that should show the SYS_CREATED_ON converted to the user-selected UTC offset time.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For the most part, the conversion works correctly.&amp;nbsp; When I set Modified Created formula to be only&amp;nbsp;&lt;FONT color="#993300"&gt;=ConvertToLocalTime(SYS_CREATED_ON, '$(SelectedTimeZone)')&lt;FONT color="#000000"&gt;, the Modified Created column in the table is formatted correctly (and displays the applicable value based on the location selected)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;&lt;FONT color="#000000"&gt;However&lt;/FONT&gt;&lt;/FONT&gt;, when I set the Modified Created field to display the SYS_CREATED_ON value if nothing is selected in the TimeZoneRegions filter (see formula below), the column displays in numeric decimal format vs standard date/time format (regardless of whether or not a value is selected).&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;=if(isnull(TimeZoneRegions), SYS_CREATED_ON, ConvertToLocalTime(SYS_CREATED_ON, '$(SelectedTimeZone)'))&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_1.png" style="width: 424px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/17578i88E52A5ED0C08D97/image-dimensions/424x230?v=v2" width="424" height="230" role="button" title="clipboard_image_1.png" alt="clipboard_image_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I get it to display correctly?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 20:44:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615650#M45831</guid>
      <dc:creator>Ruthie09</dc:creator>
      <dc:date>2019-08-22T20:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date/Time formatting in If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615668#M45832</link>
      <description>&lt;P&gt;Just use date(&lt;SPAN&gt;SYS_CREATED_ON&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;The function&amp;nbsp;&lt;SPAN&gt;ConvertToLocalTime expects a timestamp as first argument, and is therefore able to read the (truly numeric) value as a date. Then it returns a dual value, which actually has the numeric value in the numeric part, but it also has in the text part the human-friendly version.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;On the contrary, when you just read&amp;nbsp;SYS_CREATED_ON, you are reading a numeric value. You have to use date() in order to make the engine use the aformentioned dual functionality.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 21:05:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615668#M45832</guid>
      <dc:creator>gmenoutis</dc:creator>
      <dc:date>2019-08-22T21:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Date/Time formatting in If statement</title>
      <link>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615673#M45834</link>
      <description>&lt;P&gt;I did modify your solution a bit by using timestamp() vs date() because I need the time to be displayed.&amp;nbsp; Thank you for helping me.&lt;/P&gt;&lt;P&gt;Also, I changed it so the first value in the list of TimeZoneRegions was "- none -" and set that to force the default value to be equiv to SYS_CREATED_ON (since it kept trying to change the time by 2 hours even when no value was selected).&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993300"&gt;=if(TimeZoneRegions='- none -', timestamp(ConvertToLocalTime(SYS_CREATED_ON,'GMT')), timestamp(ConvertToLocalTime(SYS_CREATED_ON, '$(SelectedTimeZone)')))&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 21:39:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Date-Time-formatting-in-If-statement/m-p/1615673#M45834</guid>
      <dc:creator>Ruthie09</dc:creator>
      <dc:date>2019-08-22T21:39:56Z</dc:date>
    </item>
  </channel>
</rss>

