本文介绍了python - 当前时间10分钟后如何查找datetime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想在当前时间10分钟后找出日期时间。假设我们从datetime import datetime
now = datetime.now()
new_now = datetime我们有

I want to find out the datetime 10 mins after current time. Let's say we have

from datetime import datetime
now = datetime.now()
new_now = datetime.strptime(now, '%a, %d %b %Y %H:%M:%S %Z')

我想在10分钟后找到这个现在 new_now 。我怎样才能做到这一点?

I want to find this now and new_now 10 minutes later. How can I do that?

推荐答案

这是与问题。您基本上只需要添加一个10分钟的来获取时间你想要。

This is a duplicate of this question. You basically just need to add a timedelta of 10 minutes to get the time you want.

now = datetime.datetime.now()
now_plus_10 = now + datetime.timedelta(minutes = 10)

这篇关于python - 当前时间10分钟后如何查找datetime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 22:29