开发者

In Python, how do I make a datetime that is 15 minutes from now? 1 hour from now? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicates:

Python - easy way to add N seconds to a datetime.time?

How to create a D开发者_StackOverflow中文版ateTime equal to 15 minutes ago?

what's the best way to do this?


d1 = datetime.datetime.now() + datetime.timedelta(minutes=15)
d2 = datetime.datetime.now() + datetime.timedelta(hours=1)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜