重叠日期 [英] Overlapping dates Algorithem
本文介绍了重叠日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一种算法来检查两个日期(开始日期,结束日期)是否与另一个两个日期(开始数据,结束日期)重叠
任何人都可以帮忙或者至少给我一种思考的方式,因为我需要应用此方法在.NET和
SQL
感谢和最佳问候
I need an algorithm to check if two dates(startdate,enddate) are overlapping with another twodates(startdata,enddate)
can any one help or atleast give me the way of thinking of it becuase i need ot apply this on .NET and on
SQL
Thanks and Best Regards
推荐答案
据我所记得,我仅作了两个比较:
我相信可以正确处理所有可能的情况.
As far as I recall, I make only two comparisons:( Start1 <= End2 ) && ( End1 >= Start2 )
I believe that properly handles all the possible situations.
这篇关于重叠日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文