11

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
  • 238,746
  • 336
  • 750
  • 1,061
  • 9
    This has already been answered lots of times, please search for it. The exact question. – user225312 Dec 29 '10 at 20:30
  • 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

46
d1 = datetime.datetime.now() + datetime.timedelta(minutes=15)
d2 = datetime.datetime.now() + datetime.timedelta(hours=1)
nosklo
  • 205,639
  • 55
  • 286
  • 290