datetime.timedelta

from django.utils import timezone
import datetime

timezone.now()
datetime.datetime(2014, 7, 18, 9, 42, 24, 531000, tzinfo=<UTC>)

timezone.now() -datetime.timedelta(days=1)
2014-07-17 09:42:05.968000+00:00

print timezone.now() + datetime.timedelta(days=1)
2014-07-19 09:42:33.500000+00:00

timezone.now() - datetime.timedelta(days=5)
2014-07-13 09:43:02.140000+00:00

timezone.now() - datetime.timedelta(hours=5)
2014-07-18 04:45:17.859000+00:00

上一篇:SQLSERVER走起 APP隆重推出


下一篇:【转】初识CGI