Show Period how long Item is on

Hello together,
I integrated the functions of my air conditioner in openhab.
In the habpanel I have a power switch to start it.
Now I want to show how long the item is ON yet.
I do not know how I can implement those function.

You need to have/create an item that holds the time when the Switch is turned ON. Such rule could be triggered when the power switch changed to ON. In the rule set the time-item (.postUpdate) to the actual time.
You also need an item that shows the time-difference.
Create another rule which is run every minute. This rule should check if the power switch is ON, if that is TRUE it should calculate the timedifference between the startingtime and the actual time and .postUpdate to the time-difference item. If the power switch is off the time-difference item should be set to 0.