Conditional Tag Write using time of day (TOD)

Hi All,
I have been trying to work out / locate an easy way to write a value to a PLC tag depending on the current time.
I want to reset a total volume reading at midnight (every day). This reset is done in the PLC hence I am trying to set a Tag (Vol_Reset) to the value 1. This tag is “Bool” so I want to turn it on (make it true / high).
I have created a “memory tag” called ‘CurrentTime’ which is = now() and I have tried creating the scripting below with no success

if {‘CurrentTime’ == 00:00}:
system.tag.write(‘PLC/Vol_Reset’, 1)
system.tag.write(‘PLC/Vol_Reset’, 0)

Is there an easier way to achieve writing to a tag at a set time of day or date?

Thank you

The now() function returns a DateTime. You need to use dateFormat() to get the comparison in your code to work.

Alternatively, you could use a transaction group. These groups can be scheduled to run at a specific time. So you could setup a group to write the tag to 1 at midnight, and then when the PLC has finished its processing let it set the value back to zero.

Thanks Brandon,
I’ll give your suggestions a try.
Thanks again for the help