Swift - How do I display portions of an hour? -
i have label i'm updating every second shows hours 100ths of hour("1.67", etc.). i'm trying show correctly, having trouble.
second = 781 let timeworked = float(second/3600) let timeworkedinhours = (string(format:"%.02f", timeworked)) timeworkedlabel.text = "\(timeworkedinhours)"
i've tried few things, nothing has worked yet. solutions?
i guess second
defined int
. define double
instead. can rid of float
cast too:
var second: double = 0 // ... let timeworked = second / 3600.0
Comments
Post a Comment