Django:日期值超出范围

时间:2015-03-13 12:08:49

标签: python django datetime

这是我的django views.py行

currentTime = datetime.datetime.now()
freezeSlotBeforeTime="58"
cuerrentTimeToFreeze = currentTime - datetime.timedelta(minutes=int(freezeSlotBeforeTime))

在上面一行我得到一个错误"日期值超出范围"。

错误:

OverflowError at /manager/summary/

date value out of range

它在ipython上工作得很好。但不是在django观点中

currentTime = datetime.datetime.now()
In [11]: freezeSlotBeforeTime="58"
In [12]: cuerrentTimeToFreeze = currentTime - datetime.timedelta(minutes=int(freezeSlotBeforeTime))

In [13]: currentTime - datetime.timedelta(minutes=int(freezeSlotBeforeTime))
Out[13]: datetime.datetime(2015, 3, 13, 16, 24, 45, 711728)

我该如何解决这个错误......

0 个答案:

没有答案