<?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: Check if a time is in the interval in Management &amp; Governance</title>
    <link>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460868#M27412</link>
    <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;// some test data, random dates in 2024 and random times&lt;/DIV&gt;
&lt;DIV&gt;D1:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; timestamp(makedate(2024) + floor(rand()*365) + rand()*24) as ts // date and time&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;AutoGenerate 1000;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;// flag if the time of ts &amp;gt;= 5:30 and &amp;lt;= 6:30&lt;/DIV&gt;
&lt;DIV&gt;D2:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; ts, // date and time&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; time(frac(ts)) as tm, // time of ts (date and time)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; date(floor(ts)) as d, // date of ts (date and time)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt; if(frac(ts) &amp;gt;= Time#('5:30', 'h:mm') and frac(ts) &amp;lt;= Time#('6:30', 'h:mm'), 1, 0) as flag_in_530_630&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;Resident D1;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;drop table D1;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maxgro_0-1718034826606.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/167654i2D6217592CCDD298/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maxgro_0-1718034826606.png" alt="maxgro_0-1718034826606.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 10 Jun 2024 15:56:28 GMT</pubDate>
    <dc:creator>maxgro</dc:creator>
    <dc:date>2024-06-10T15:56:28Z</dc:date>
    <item>
      <title>Check if a time is in the interval</title>
      <link>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460619#M27405</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;would like to check whether a time is between 5.30 and 6.30. How can I do this? This should be checked for each day. The time is preceded by the day, can I solve this with Time()?&lt;BR /&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 07:41:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460619#M27405</guid>
      <dc:creator>Just6</dc:creator>
      <dc:date>2024-06-10T07:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a time is in the interval</title>
      <link>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460627#M27406</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/149764"&gt;@Just6&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;To check if a time is within a specific interval:&lt;/P&gt;
&lt;P&gt;// Load initial data&lt;BR /&gt;TimeTable:&lt;BR /&gt;LOAD *,&lt;BR /&gt;Time#(MyTime, 'DD/MM/YYYY hh.mm') as ParsedTime&lt;BR /&gt;FROM [YourDataSource];&lt;/P&gt;
&lt;P&gt;// Create an interval table that defines your time range for each day&lt;BR /&gt;IntervalTable:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;StartTime, EndTime&lt;BR /&gt;05:30, 06:30&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;// Use IntervalMatch to link your time field with the interval defined by StartTime and EndTime&lt;BR /&gt;IntervalMatch (ParsedTime)&lt;BR /&gt;LOAD StartTime, EndTime&lt;BR /&gt;RESIDENT IntervalTable;&lt;/P&gt;
&lt;P&gt;// Now you can use the matched intervals in your expressions to check if times fall within the range&lt;/P&gt;
&lt;P&gt;// Check if time falls within the interval&lt;BR /&gt;LOAD *,&lt;BR /&gt;IF(&lt;BR /&gt;Time(Timestamp#(TimestampField, 'DD.MM.YYYY hh:mm')) &amp;gt;= Time(MakeTime(5, 30)) &lt;BR /&gt;AND &lt;BR /&gt;Time(Timestamp#(TimestampField, 'DD.MM.YYYY hh:mm')) &amp;lt;= Time(MakeTime(6, 30)),&lt;BR /&gt;'Within Interval',&lt;BR /&gt;'Outside Interval'&lt;BR /&gt;) AS TimeInIntervalFlag&lt;BR /&gt;RESIDENT YourDataSource;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;***Hope this resolve your issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the issue is solved please mark the answer with Accept as Solution &amp;amp; like it.***&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 08:12:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460627#M27406</guid>
      <dc:creator>TauseefKhan</dc:creator>
      <dc:date>2024-06-10T08:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a time is in the interval</title>
      <link>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460868#M27412</link>
      <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;// some test data, random dates in 2024 and random times&lt;/DIV&gt;
&lt;DIV&gt;D1:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; timestamp(makedate(2024) + floor(rand()*365) + rand()*24) as ts // date and time&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;AutoGenerate 1000;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;// flag if the time of ts &amp;gt;= 5:30 and &amp;lt;= 6:30&lt;/DIV&gt;
&lt;DIV&gt;D2:&lt;/DIV&gt;
&lt;DIV&gt;LOAD&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; ts, // date and time&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; time(frac(ts)) as tm, // time of ts (date and time)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; date(floor(ts)) as d, // date of ts (date and time)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt; if(frac(ts) &amp;gt;= Time#('5:30', 'h:mm') and frac(ts) &amp;lt;= Time#('6:30', 'h:mm'), 1, 0) as flag_in_530_630&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;Resident D1;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;drop table D1;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="maxgro_0-1718034826606.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/167654i2D6217592CCDD298/image-size/medium?v=v2&amp;amp;px=400" role="button" title="maxgro_0-1718034826606.png" alt="maxgro_0-1718034826606.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Jun 2024 15:56:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Check-if-a-time-is-in-the-interval/m-p/2460868#M27412</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2024-06-10T15:56:28Z</dc:date>
    </item>
  </channel>
</rss>

