Problems With hourly formate

Hi all,

Can someone give me a little advice how to change the result of

$if(bi(charging) = 0, "unplugged", "plugged")$ $tf(bi(plugged))$

to always HOURS? In case the result is bigger then 23 hours or only says "1 day, 2 days and so on...".

Eventually the formula itself can ne reduced? I only need the amount of hours(!) since last unplugging (to see how much is the time of usage up to battery Zero ;-)

Many thanks in advance