# How to create specific time interval tags?

Good night, my name is Felipe and I’m a beginner in ignition. I received a mission at the company where I work to separate production data by shift. the shifts are divided into: A, B, C and D. Each shift works for 3 days and is off for 3 days. for example: shift A starts today, 27/04/2020, from 7:00 am to 7:00 pm, shift B enters at 7:00 pm and leaves at 7 am the other day and so successively working on days 27,28 and 29. shift C enters on April 30, 2020 at 7:00 am until 7:00 pm and shift D enters from 7:00 pm until 7:00 am morning of the other day and so on during the days 30.01 and 02. and the cycle repeats again starting with A and B.
I would like to create 4 tags, each referring to each shift so that managers can see which shift is taking greater production volume and efficiency. today this work is being done using the calendar component. but the idea is to use the calendar in parallel with 4 buttons, one for each shift. and depending on the interval set by the calendar and after pressing the button for the chosen shift, the production volume appears in a numeric label component.
I don’t know if I was very clear, but thank you in advance.

this sounds like a MES application
What is the content and type of this 4 tags? maybe just a int value indicating which shift is currently active?
You may want to use Schedule Management Component

We have a nice 6-day repeating pattern here. So, we can start with a tag that contains a base datetime. We’ll use 2020-04-27 07:00:00 that was mentioned as the first day of shift A’s schedule.

Next we have a string tag that has the current time.

Third, we can use a modulus function to see where in the six day cycle we are sitting. This will return a value of 0-5. 0-2 for A/B shifts and 3-5 for C/D shifts:

``````daysBetween({[.]baseDateTime}, now()) % 6
``````

Last, we can put it all together and discover the current shift:

``````if({[.]moduloDays} < 3,
if(timeBetween({[.]CurrentTime}, '7:00 am', '7:00 pm'),
'A',
'B'
),
if(timeBetween({[.]CurrentTime}, '7:00 am', '7:00 pm'),
'C',
'D'
)
)
``````