How does this ghpython script get tweaked so it reads Hours, minutes, seconds?
hours = x
seconds = hours * 3600
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
a= “%d:%02d:%02d” % (h, m, s)
ghpython time.gh (6.0 KB)
How does this ghpython script get tweaked so it reads Hours, minutes, seconds?
hours = x
seconds = hours * 3600
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
a= “%d:%02d:%02d” % (h, m, s)
ghpython time.gh (6.0 KB)
from datetime import datetime
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)
seconds = x * 60
m, s = divmod(seconds, 60)
s=round(s)
h, m = divmod(m, 60)
a= "%dh:%02dm:%02ds" % (h, m, s)
@Tao_Lin … almost there … it rounds the seconds, what needs to be adjusted?
@mikity_kogekoge … I’m new to ghpython … how do I get this to work with the component?
what do x and a equal?
right click x,change type hint from int to float.
@Tao_Lin … you did say that in our original post … thank you!