dim on_time as int
dim on_hr as byte
dim on_min as byte
on_time = 1234 '// 12 Hour and 34 minutes want to Sprite hours and minutes into 2 separate byte on_Hr $ on_min
'// Want result >>
on_hr = 12
on_min = 34
on_min = on_time Mod 100
on_hr = (on_time - on_min) / 100 'the subtraction isn't strictly necessary but it avoids the question about rounding when casting Double to Int
If on_time >= 0 And on_time <= 2400 Then 'because some people differentiate between midnight at start of day, and midnight at end of day
Dim HHMM As String = on_time
Do While HHMM.Length < 4
HHMM = "0" & HHMM
Loop
on_hr = HHMM.SubString2(0, 2)
on_min = HHMM.SubString(2) 'same as .SubString(2, 4)
Else
Log("invalid time")
End If
Or as String but you don't like the concatenating:
Poor Man's RSET:
Dim XHHMM As String = on_time + 10000 'assuming on_time is 0..2400 then XHHMM will be 10000..12400 ie 5 digits
on_hr = XHHMM.SubString2(1, 3)
on_min = XHHMM.SubString(3, 5)