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.20.5.tar.gz
(79.0 kB
view details)
Built Distribution
File details
Details for the file scidatetime-1.20.5.tar.gz
.
File metadata
- Download URL: scidatetime-1.20.5.tar.gz
- Upload date:
- Size: 79.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47e2cda9399e6d8b683b0b3c630870c523017d7bd6af7d557fe06d7856699e4e |
|
MD5 | 97fc47653811256c24290740d8273708 |
|
BLAKE2b-256 | 7274d1a1c76e7d4d1f319f47bc4970e45389568d3db668b2c55498e15ec3f3f1 |
File details
Details for the file scidatetime-1.20.5-py3-none-any.whl
.
File metadata
- Download URL: scidatetime-1.20.5-py3-none-any.whl
- Upload date:
- Size: 86.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62fa71c067bc97a25c4d446fa8a3f34dcbe8f6137f8301e06638ca94818085a9 |
|
MD5 | bfb981b1e4f2c83e18b593e1112f47b3 |
|
BLAKE2b-256 | 601a0a22b5e77c493f6cc82724dd5cf34cc447797a8fab3c9f03c647e9d03fcc |