Calculating time offset

I am setting up an event-based rule. Upon triggering, I would like it to calculate the number of minutes (or seconds) between “NOW” and Astro’s sunset event. The sunset event is defined as a DateTime named “Sunset_Time”.

I then plan to send that number to a remote device via MQTT. I have the rule and MQTT functionality working perfectly, but I can’t figure out how to properly calculate the offset number. Can you suggest an approach?


This could help:

Thank you, @vzorglub. I will have a read.