如何找到两个日期之间的天数有什么区别? [英] How to find the difference in days between two dates?
本文介绍了如何找到两个日期之间的天数有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
A =2002-20-10结果
B =2003-22-11
A="2002-20-10"
B="2003-22-11"
如何找到两个日期之间的天数不同?
How to find the difference in days between two dates?
推荐答案
如果您有GNU 日期
,它允许打印任意日期重新presentation ( -d
选项)。
在这种情况下,日期转换为纪元以来的秒数,并减去24 * 3600分。
If you have GNU date
, it allows to print the representation of an arbitrary date (-d
option).
In this case convert the dates to seconds since EPOCH, subtract and divide by 24*3600.
或者您需要一个可移植的方式?
Or you need a portable way?
这篇关于如何找到两个日期之间的天数有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文