Ok, I know how to do this if I know how to convert say 1423 to a string, is there an easy way to do this?

or is there a math trick to this?

to get the AM/PM I can substract the number by 1300 and see if it's positive or negative, however I don't know how to get the hours and minutes