本文介绍了毫秒到几天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做了一些研究,但仍然找不到如何得到这些日子......这就是我得到的:
i did some research, but still can't find how to get the days... Here is what I got:
int seconds = (int) (milliseconds / 1000) % 60 ; int minutes = (int) ((milliseconds / (1000*60)) % 60); int hours = (int) ((milliseconds / (1000*60*60)) % 24); int days = ????? ;请帮助,我吮吸数学,谢谢。
Please help, I suck at math, thank's.
推荐答案如果您没有比天数更大的时间间隔:
If you don't have another time interval bigger than days:
int days = (int) (milliseconds / (1000*60*60*24));如果您还有周数:
int days = (int) ((milliseconds / (1000*60*60*24)) % 7); int weeks = (int) (milliseconds / (1000*60*60*24*7));如果可能的话,最好避免使用数月和数年,因为他们没有良好的定义固定长度。严格来说,日子也不是:夏令时意味着日子的长度可以不是24小时。
It's probably best to avoid using months and years if possible, as they don't have a well-defined fixed length. Strictly speaking neither do days: daylight saving means that days can have a length that is not 24 hours.
更多推荐
毫秒到几天
发布评论