What is the best way for date and time compare ?

Avatar
  • updated

Hello


The first ask:

I would like know the best way for compare actual date and time with variable for trigger a  tasks program.

The second  ask:

How to check if value is including between x and y

Best regards

Avatar
Fabien Fuster

Hi,

Try by doing "if" "general/day"=x and "if" "general/month"=y, do ..... As trigger, I guess you have to put both "general/day" and "general/month", both to allowed to retrigger.

Regards,

Avatar
Gruyère Energie SA

Thank you Fabien and Ricardo for your answers.

Ricrardo in my case I would like compare only date 24/03 in your exemple. The year should not be compared.

I would like find a period for each year without change every year of the comparaison

Best regards.

Avatar
Ricardo Pinto

Hello,

Complementing Fabien reply, probably I would something like this for the 1st:

- Create a Program task,

- On the trigger, choose Time, ValueChanged(OnChange);

- Bellow, on the program body, create an If

- Choose Time, Value, Equals(=), and place the date and time of the day you want

- Inside that If, create what you want to do

- If you have more than one condition, you need to create a "tree" inside the first If

Kinda like:


Best regards
 

Avatar
Fabien Fuster

Hi,

Can you provide a bit more info about what you try to achieve for the 1st item ?

For the second one, you need to write a program to be retriggered every time the given value is changing and above X (in your trigger) and "if" below Y, do ..... (in your program). Alternatively, you can do "if" above X and "if" below Y, do.... (in your program) and simply task the program to be retriggered every time the given value is changing.

Hope this helps,