我想接受特定时间范围内的订单,简单地说,我想验证订单,如果它们是在8:00-19:00之间,无论它是哪一天或哪一天。
您可以使用datetime:
def your_function(request):
current_time = dt.now(tz=zoneinfo.ZoneInfo('UTC'))
if 8 < current_time.hour < 19:
# Accept the order and process accordingly
else:
# Don't accept and send different response