scidatetime is python module for DateTime handle.
Project description
What?
scidatetime is python module for DateTime handle.
Install
pip install scidatetime
Usage
from scidatetime import DateTime
# 当前时间
print(DateTime()) # 2023-09-19 14:50:43.570560+08:00
# 指定日期
print(DateTime('2023-09-19')) # 2023-09-19 00:00:00+08:00
# 指定时间
print(DateTime('2023-09-19 14:50:43')) # 2023-09-19 14:50:43+08:00
# 指定时间戳
print(DateTime(1695106243000)) # 2023-09-19 14:50:43+08:00
# 指定时间及时区
print(DateTime('2023-09-19T14:50:43+07:00')) # 2023-09-19 14:50:43+07:00
# 计算时间差
print((DateTime('2023-09-20') - '2023-09-19').total_seconds()) # 86400.0
print((DateTime('2023-09-20') - 60 * 1000)) # 2023-09-19 23:59:00+08:00
# 获取相对时间
print(DateTime('2023-09-20').toRelativeTime('2023-09-20 14:23')) # 14小时前
print(DateTime('2023-09-20 10:00:00').toRelativeTime('2023-09-20 10:01:00')) # 1分钟后
print(DateTime('2023-01-20 10:00:00').toRelativeTime()) # xxx年前
Status
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
scidatetime-1.17.10.tar.gz
(74.2 kB
view hashes)
Built Distribution
Close
Hashes for scidatetime-1.17.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc4716ca9bf88a842e57f298983449fdb363bc485f7625be6d8571452055413a |
|
MD5 | ba0f11355823084c6c8f23ba7c738b37 |
|
BLAKE2b-256 | 0be25312ce3d90c5679cf58603e0adc956dff1634349154aaf54927e5f14a9ce |