-8
A
回答
0
我认为这个问题会在你有几个月的时候发挥作用。
“月份”太笼统了,是1月份还是2月份?该实用程序如何知道每个月将包含多少天?
此外,这一年还会在这里更改数据。
为了您的需要,您绝对可以使用乔达时间,但您将需要为适合的计算创建您自己的方法。
0
为什么不试试TimeUnit并避免重新发明轮子?
public static void main(String args[]) throws InterruptedException {
// "3 days 2 hours 3 seconds"
long secondsConverted = fooMEthod(3, 2, 3);
System.out.println("secondsConverted: " + secondsConverted);
}
private static long fooMEthod(int i, int j, int k) {
Long total = TimeUnit.DAYS.toSeconds(i) + TimeUnit.HOURS.toSeconds(j) + k;
return total;
}
相关问题
- 1. 添加日期时间(秒)
- 2. 日期时间力毫秒
- 3. 日期时间到秒
- 4. MYSQL - 日期时间到秒
- 5. php日期时间分数秒秒
- 6. 如何以日期时间格式打印秒数?
- 7. 如何在sharepoint 2010中以毫秒保存日期时间
- 8. 如何将日期/时间以秒为单位转换为日期/时间我们可以读取?
- 9. 转换日期时间用毫秒到SQL日期时间
- 10. Python将秒转换为日期时间日期和时间
- 11. 如何打印日期时间,毫秒毫秒
- 12. 时间以秒或毫秒
- 13. 如何获取日期时间间隔秒(int)?
- 14. 意外的结果转换时的日期时间(1970,1,1),以秒
- 15. 日期时间和秒表值比较
- 16. SAS信息日期时间毫秒
- 17. 秒到日期和时间格式
- 18. 毫秒格式解析日期时间?
- 19. 将毫秒转换为日期/时间
- 20. Max(日期时间)忽略秒
- 21. 获取毫秒日期和时间
- 22. 从UTC秒创建日期时间
- 23. C++日期和时间用毫秒
- 24. 向日期时间添加秒
- 25. Rails日期时间输入和微秒
- 26. 日期时间降低到秒的Python
- 27. 转换日期和时间为毫秒
- 28. 微秒中的时间日期差异
- 29. 日期时间得到由1秒
- 30. SQL日期时间查询删除秒
一个月多久? – Leon