Help Countdown Widget

So if I put:
$if(df(hhmm)>=700 & df(hhmm)<1200, tf(12h00m00s,hh:mm:ss))$

It will start a countdown from 7 o’clock to 12 o’clock, and the countdown will look like this 05:00:00
And when it reach less than one hour left the countdown gonna be look like this 00:59:59.
The hour gonna be 00, so how do I remove it and make it display 59:59?
Same when it reach less than a minute, how do I make it only display the second?

And my second question is is there a way to make the hour as a minute? For example 02:30:00, how to make it to 150:00 (150 as the minute)

There’s probably more than one way to do this, but what comes to mind is to simply nest another “if” statement that detects if the hh part of the tf function is zero and change the format. Something like:

$if(df(hhmm)>=700 & df(hhmm)<1200, if(tf(12h,hh)=00, tf(1200m00s,mm:ss), tf(1200m00s,hh:mm:ss)))$

As for converting hours to minutes, I don’t think that there’s an existing function that does this automatically, but you can do a simple math instead.

$df(h) * 60 + df(m)$