python - 如何使用 python 在第 0 年创建一个日期时间对象

标签 python datetime

正如标题所言。如果我尝试这样做,它会给我一个年份值的 ValueError,但我想要一个日期时间为 0 年的日期时间。有什么办法可以做到这一点吗?

最佳答案

来自文档

The datetime module exports the following constants:

datetime.MINYEAR The smallest year number allowed in a date or datetime object. MINYEAR is 1.

datetime.MAXYEAR The largest year number allowed in a date or datetime object. MAXYEAR is 9999.

关于python - 如何使用 python 在第 0 年创建一个日期时间对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17709751/

相关文章:

python - 使用 Python 的 Apple 推送通知服务

python - BeautifulSoup 元素输出到列表

python - 将时间转换为 float

datetime - DateTime.ToString ("s")是否总是返回相同的格式?

r - POSIXlt 组件的提取在 R 3.4.4 中运行良好,但在 R 3.5.0 中出现错误。为什么?

python - 使用 Boto 从 AWS Glacier 下载大型文件

python - 如何在 tensorflow 中检查 GPU 是否存在而不生成警告

python - 我的时间数据 "does not match format"。如何正确格式化我的日期时间?

ios - 当系统设置为使用 24 小时格式时,如何获取 12 小时格式的时间字符串

python - 在Python中,如何进行像: partial(adder , 2)(4)这样的部分函数调用?