在Python中处理日期/时间最简单的方法是什么? [英] What is the easiest way to handle dates/times in Python?
本文介绍了在Python中处理日期/时间最简单的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该使用datetime模块吗?
或只是strftime?
或者不是Python的std发行版的一部分歌手?
解决方案
你可以看看Django的人性化模块。
它是Django的一部分,但是我觉得根据你的需要来调整它是很容易的。
My use case is that I'm just making a website that I want people all over the world to be able to use, and I want to be able to say things like "This happened at 5:33pm on October 5" and also "This happened 5 minutes ago," etc.
Should I use the datetime module? Or just strftime? Or something fancier that isn't part of the std distro of Python?
解决方案
You may have a look at Django's humanize module.
It is part of Django, but I think it would be quite easy to adapt it to your needs.
这篇关于在Python中处理日期/时间最简单的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文