我有很多公司,每一家公司都有开业日期和截止日期,例如:
Company Open CloseA 08.00 22.00 (close in the **same** day)
B 10.00 02.00 (close in the **second** day)
C 14.00 03.00 (close in the **second** day)在网页上,用户必须查看公司列表,并根据当前时间(服务器时间)显示每个公司的状态(、open或close)。
问题:当公司在同一天打开或关闭时(A),很容易在以下算法中获得状态:isOpen = (NOW > OpenTime AND NOW < ClosingTime),但如果公司在第1天打开,在第2天关闭,如果用户在1点检查页面,则公司B将出现关闭(因为(1.00 > 10.00 AND 1.00 < 02.00)是False ),但会实时打开。
如何解决这个问题(当关闭时间日与开幕时间日不同时)
发布于 2012-02-16 18:50:42
如果打开时间晚于关闭时间,则反转测试。
https://stackoverflow.com/questions/9317208
复制相似问题