我试图检查某个日期时间是否等于db的日期时间,然后再检查一次时间是否大于另一次。
代码如下:
{% for order in orders %}
{% if order.hour_id.open == dic and order.status == 'Reserved' %}
<div class="col late pastDate" data-dayid="22" data-timeid="38"
data-price="65000" data-time="38"
data-day="1" data-start="3" data-end="9" data-date="1398/2/14">reserved
</div>
{% set x = False %}
{% elif order.hour_id.open == dic and order.status == 'Reserving' %}
<div class="col late onrezerv" data-dayid="22" data-timeid="41"
data-price="65000" data-time="41"
data-day="1" data-start="39" data-end="45" data-date="1398/2/14">reserving
{% set x = False %}
{% endif %}
{% endfor %}
这是我的字典
在我国,工作日的第一天是星期六
day_of_week_miladi = {
"shanbe": start_week_miladi - timedelta(days=2),
"yeshanbe": start_week_miladi + timedelta(days=1) - timedelta(days=2), "doshanbe": start_week_miladi + timedelta(days=2)- timedelta(days=2),
"seshanbe": start_week_miladi + timedelta(days=3)- timedelta(days=2), "charshanbe": start_week_miladi + timedelta(days=4)- timedelta(days=2),
"panjshanbe": start_week_miladi + timedelta(days=5)- timedelta(days=2), "jome": start_week_miladi + timedelta(days=6)- timedelta(days=2)
}
我想比较两个特殊的日期时间
one = datetime.strptime('00:30:00','%H:%M:%S').time()
two = datetime.strptime('06:30:00','%H:%M:%S').time()
three = datetime.strptime('08:00:00','%H:%M:%S').time()
four = datetime.strptime('09:30:00','%H:%M:%S').time()
five = datetime.strptime('11:00:00','%H:%M:%S').time()
six = datetime.strptime('12:30:00','%H:%M:%S').time()
...
在这本词典中,我试图结合时间和日期:
datetime_three = {}
for id,dict in day_of_week_miladi.items():
datetime_three[id] = datetime.combine(dict,three)