开发者

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

开发者 https://www.devze.com 2023-02-01 11:06 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicates: Python - easy way to add N seconds to a datetime.time?
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

精彩评论

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