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

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -