友好的日期和时间
whenp的Python项目详细描述
用户友好的功能,帮助执行常见的日期和时间操作。
用法
要获取系统时区名称:
when.timezone()
要获取当前日期:
when.today()
得到明天的日期:
when.tomorrow()
获取昨天的日期:
when.yesterday()
一年后获取日期时间:
when.future(years=1)
要转换到其他时区:
when.shift(value, from_tz='America/New_York', to_tz='UTC')
获取当前时间:
when.now()
完整的文档可以在Read the Docs上找到。
安装
安装when.py很容易:
pip install whenpy
或者下载源代码并运行:
python setup.py install