title: How to work with real time in custom function block on ST in Codesys 3.5
body: <p>I am trying to accomplish very simple task, but it looks like I cannot figure our how.</p>
  
  <p>My task is daily schedule. output <code>Q1</code> have to be <code>HIGH</code> every day from 1:00 to 2:00. I could not find function block that would help me. I decided to create my own.</p>
  
  <p>Here are my definitions.</p>
  
  <pre><code>FUNCTION_BLOCK Shedule
  VAR_INPUT
      EN: BOOL;
  
      MO: INT;
      TU: INT;
      WE: INT;
      TH: INT;
      FR: INT;
      SA: INT;
      SU: INT;
  
      T1: STRING;
  END_VAR
  VAR_OUTPUT
      Q: BOOL;
  END_VAR
  </code></pre>
  
  <p>The idea is this. <code>EN</code> is input. It should be <code>HIGH</code> for output <code>Q</code> to become <code>HIGH</code> too.</p>
  
  <p>Others are days of the week. I can set 1 or 0 if I want Schedule work on that day. Pretty much universal function block to create any type of schedules.</p>
  
  <p><strong>Question 1</strong>: When I make week day variables type <code>BOOL</code>, when I add block to the LD line, it creates contact for every week day parameter.</p>
  
  <p><a href="https://i.stack.imgur.com/fcn3r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fcn3r.png" alt="enter image description here"></a></p>
  
  <p><strong>What can I do to make only <code>EN</code> contact connected to the line?</strong></p>
  
  <p>If I try to add function block with EN/ENO, then I do not know</p>
  
  <p>1) How do I know inside function block that <code>EN</code> is <code>HIGh</code> or how do I get access to that variable?
  2) I cannot connect coil to my <code>Q</code> output. it only connects to <code>ENO</code>. how do i control state of <code>ENO</code>?</p>
  
  <p>But that is not all. I added Time and Date library</p>
  
  <p><a href="https://i.stack.imgur.com/LJBSR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LJBSR.png" alt="enter image description here"></a></p>
  
  <p>But only thing I found to work with time is <code>RTCLK.GetDateAndTime</code> function block. And i cannot figure out how to work with it. </p>
  
  <p>My simple task is to get current TIME only and current day of the week and if this week is enabled and current time in the range in input <code>T1</code> - make <code>Q</code> = <code>HIGH</code> otherwise <code>LOW</code>.</p>
  
  <p><strong>Any hints on that?</strong> </p>