Energy consumption of raspberry pi connected led

Hi everyone.
I want to calculate the energy consumption of led which is connected with raspberry. Can anyone suggest to me, how can it be done?

Multiply the power of the led in Watts by the time it is on in hours and divide by 1000 to give kW hours.

Thanks for your kind reply, But how can I measure the time?

A quick search of the node red flows site found this which might be helpful