I need to convert decimal value to hex, to send it to RTC. Seems like PBP has no built in convertors?

I have hex values such as rtcmin, rtcsec, rtchour and so on.
I have a decimal variable which changes on button press. Have to convert it to hex, but can't find proper statement.
Of course I can do it by hand, like this

Code:
IF TIMEVAR=10 THEN RTCMIN=$10
IF TIMEVAR=11 THEN RTCMIN=$11
and so on, but just to set minutes, I will need 60 lines of code!

Why statements like RTCMIN=HEX TIMEVAR or RTCMIN=$TIMEVAR do not work?