14

Possible Duplicates:
Python - easy way to add N seconds to a datetime.time?
How to create a DateTime equal to 15 minutes ago?

what's the best way to do this?

Community
  • 1
  • 1
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
  • 9
    This has already been answered lots of times, please search for it. The exact question. – user225312 Dec 29 '10 at 20:30
  • 1
    http://stackoverflow.com/questions/4541629/how-to-create-a-datetime-equal-to-15-minutes-ago. Let's think. That answer must be helpful. And -- bonus -- it contains some links to other duplicate questions. – S.Lott Dec 29 '10 at 20:33

1 Answers1

54
d1 = datetime.datetime.now() + datetime.timedelta(minutes=15)
d2 = datetime.datetime.now() + datetime.timedelta(hours=1)
nosklo
  • 217,122
  • 57
  • 293
  • 297