<?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 Time Format within IF Statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315000#M116206</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a DateTime field in my database.&amp;nbsp; I need an expression to show whether the time is "Day" or "Night".&amp;nbsp; "Night" is defined as between 19:00 (7:00 PM) and 07:00 (7:00 AM).&amp;nbsp; I need some help with the time syntax. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried these, but nothing is working so far: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(TIME(DateTime)&amp;gt;1900 OR TIME(DateTime)&amp;lt;0700,"Night","Day")&lt;/P&gt;&lt;P&gt;IF(TIME(DateTime)&amp;gt;19 OR TIME(DateTime)&amp;lt;07,"Night","Day")&lt;/P&gt;&lt;P&gt;IF(TIME(DateTime)&amp;gt;19:00 OR TIME(DateTime)&amp;lt;07:00,"Night","Day")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong here?&amp;nbsp; Is it a syntax problem with the times, or is it the IF statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sam. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Dec 2011 15:49:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-12-20T15:49:26Z</dc:date>
    <item>
      <title>Time Format within IF Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315000#M116206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a DateTime field in my database.&amp;nbsp; I need an expression to show whether the time is "Day" or "Night".&amp;nbsp; "Night" is defined as between 19:00 (7:00 PM) and 07:00 (7:00 AM).&amp;nbsp; I need some help with the time syntax. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried these, but nothing is working so far: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(TIME(DateTime)&amp;gt;1900 OR TIME(DateTime)&amp;lt;0700,"Night","Day")&lt;/P&gt;&lt;P&gt;IF(TIME(DateTime)&amp;gt;19 OR TIME(DateTime)&amp;lt;07,"Night","Day")&lt;/P&gt;&lt;P&gt;IF(TIME(DateTime)&amp;gt;19:00 OR TIME(DateTime)&amp;lt;07:00,"Night","Day")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong here?&amp;nbsp; Is it a syntax problem with the times, or is it the IF statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sam. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 15:49:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315000#M116206</guid>
      <dc:creator />
      <dc:date>2011-12-20T15:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Time Format within IF Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315001#M116207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's rather a question of formatting. I'd use instead the InDayToTime function:&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"&gt;&lt;P&gt;=If(InDayToTime(Time('23:00'), Time('19:00'), 0, Num(Time('07:00'))), 'Day', 'Night')&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the first parameter is the time, the second is the end of the day and the third is the beginning of the day. If InDayToTime returns -1 (true) then the time is between 07:00 and 19:00, so Day, otherwise Night.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 16:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315001#M116207</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-12-20T16:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Time Format within IF Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315002#M116208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; Miguel:&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Thanks for the idea.&amp;nbsp; I tried editing your expressions slightly, to read the time from my OrderDateTime field.&amp;nbsp; Unfortunately, that expression is returning "Night" for every record, so there's still something wrong with the syntax:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/SPAN&gt;&lt;DIV&gt;=If(InDayToTime(Time(OrderDateTime,'hh:mm'), Time('19:00'), 0, Num(Time('07:00'))), 'Day', 'Night') &lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 10pt;"&gt;Any idea what I'm doing wrong?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 16:56:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315002#M116208</guid>
      <dc:creator />
      <dc:date>2011-12-20T16:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Time Format within IF Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315003#M116209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm pretty sure it's something related to formats. You need to extract the time part from your timestamp, something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Time(Frac(OrderDateTime))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:46:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Time-Format-within-IF-Statement/m-p/315003#M116209</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-12-20T18:46:08Z</dc:date>
    </item>
  </channel>
</rss>

