when_start = models.DateTimeField()
when_end = models.DateTimeField()
如何在when_start
和when_end
之间获得分钟差异?
my_minutes = when_end - when_start = #number of minutes
答案 0 :(得分:2)
我愿意
my_minutes = (when_end - when_start).total_seconds() / 60
答案 1 :(得分:2)
当你减去时,你会得到这样的东西:
datetime.timedelta(0, 5, 41038)
将其转换为分钟:
minutes = (when_end - when_start).total_seconds()/60