I have two dates and I'm wondering how to check if their difference is at least 2 months or greater.
我有两个约会,我想知道如何检查他们的差异是否至少2个月或更长。
Currently I'm converting both dates to seconds since Jan 1900 and then checking the difference in seconds and comparing it to the # of seconds in a month. Does C have a better built in function that gives timespans?
目前我将这两个日期转换为自1900年1月以来的秒数,然后以秒为单位检查差异并将其与一个月中的秒数进行比较。 C有更好的内置功能,可以提供时间跨度吗?
My date format: MM/DD/YYYY
我的日期格式:MM / DD / YYYY
2 个解决方案
#1
3
C has difftime which basically does what you are doing. There are many more powerfully date libraries you can use.
C有difftime,它基本上可以做你正在做的事情。您可以使用更多功能强大的日期库。
#2
#1
3
C has difftime which basically does what you are doing. There are many more powerfully date libraries you can use.
C有difftime,它基本上可以做你正在做的事情。您可以使用更多功能强大的日期库。