IF H% - 12 < 10 THEN hour$ = {{Cl|STR$}}(H% - 12) ELSE hour$ = {{Cl|LTRIM$}}({{Cl|STR$}}(H% - 12))
ELSEIF H% = 0 THEN hour$ = "12" ' midnight hour
ELSE : IF H% < 10 THEN hour$ = {{Cl|STR$}}(H%) ' eliminate leading zeros
END IF
Clock$ = hour$ + min$ + ampm$
END FUNCTION
{{CodeEnd}}
{{OutputStart}}
14:13:36
2:13 PM
{{OutputEnd}}
:''Explanation:'' When hours are less than 10 (but not 0), {{KW|STR$}}(H%) alone keeps a space ahead of the hour. For 2 digit hours, {{KW|LTRIM$}} is used to remove that leading space. For the hours of 10 AM to 12 PM, the hour {{KW|STRING}} value is passed from {{KW|LEFT$}}(TIME$, 2) at the beginning of the function.