I have a variable that contains my sprinkler start time in 24 hr format without a colon. e.g. 2230
Looking for a method, other than applescript, to convert it to 12 hr. e.g. 10:30 pm
Appreciate any input on the best way to do it.
Thanks,
Carl
old = indigo.variables["varnname'].value
hours = int(old[:-2])
minutes = old[-2:]
ampm = " am" if hours < 12 else " pm"
new = str(hours%12) + minutes + ampm
indigo.updatevariable("varname",new)
new = str(hours%12) + " : " + minutes + ampm
Users browsing this forum: No registered users and 8 guests