Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I compare two unix numbers to each other, and need to convert difference into Days, Hours, Minutes and secounds. How do I do this?
- Thanks in advance
unixtime/1000 = seconds
unixtime/60000 = minutes
unixtime/3600000 = hours
unixtime/86400000 = days
You can use the % (modulo) operator to get the remainder after dividing.
Also, check out this demo how to display time in hh:mm:ss.ms format
Develop games in your browser. Powerful, performant & highly capable.
oosyrag. I don't understand how to use %? I can't seem to figure out how to use it, so that every time secounds hit 60, the minutes add up with 1.
You need to work backwards. Modulo gives you the remainder after dividing. So imagine 132 total seconds. First you need to divide by 60 and round down to get the number of minutes, which is 2. The remainder after that is 12, which would be your seconds.
Thank you so much. I understand now ^^