The following record of the DateTime module Some of the methods used, first print out the current time, and then print out before and after 3 days, after 3 hours, after 3 minutes, after 3 seconds of expression, below look at the code:
Import datetime Now
= Datetime.datetime.now ()
print now
#往后3小时, 2 days, 3 minutes, 3 seconds
Print Datetime.datetime.now () + Datetime.timedelta (hours=3)
print datetime.datetime.now () + Datetime.timedelta (days=3 )
print Datetime.datetime.now () + Datetime.timedelta (minutes=3)
print datetime.datetime.now () + Datetime.timedelta (seconds=3)
Here's how it works:
2011-03-04 14:07:18.437000
2011-03-07 14:07:18.437000
2011-03-04 17:07:18.437000
2011-03-04 14:10:18.437000
2011-03-04 14:07:21.437000
This article from "You are a passer-by or fearless" blog, please be sure to keep this source http://world77.blog.51cto.com/414605/506415