What would be the best algorithm / code to convert time to float? I’m doing this in Obj-c but really all I need is an algorithm and I can make the code from there.
EX:
- 1:30am to 1.50
- 2:15pm to 14.25
- 5:45pm to 17.75
EDIT:
My time format is minutes since midnight.
You can parse the string to get two
intnumbers and anam/pmpart (h,m, anda), and then calculate the fraction as follows: