some usual tool with class
Project description
function_tool工具包
安装:
pip install function_tool
本工具包对一些常用的功能进行了Python封装,目前主要包含以下功能:
1. 日期时间类
DateTimeTool
- timestamp2time函数:Unix时间戳转时间字符串
- time2timestamp函数:时间字符串转Unix时间戳
- get_range_of_date_by_str函数:返回给定时间所在日期的时间戳范围
- get_difference_between_time函数:返回给定的两个时间的差值 使用示例
from function_tool_derrick.UsualTool import DateTimeTool # 导入function_tool_derrick.UsualTool下的DateTimeTool类
if __name__ == '__main__':
print(DateTimeTool.timestamp2time(1681721029)) # 打印 2023-04-17 16:43:49
print(DateTimeTool.time2timestamp('2023-04-17 16:43:49')) # 打印 1681721029
ret = DateTimeTool.get_range_of_date_by_str('2022-02-02 15:30:28', formatter='%Y-%m-%d %H:%M:%S', tsType=TimestampType.MILLISECOND)
print(ret) # 打印 [1643731200000, 1643817599999]
print(DateTimeTool.get_difference_between_time('2024-02-20 08:30:00', '2024-02-20 08:31:30')) # 打印90
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
function_tool-0.0.4.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file function_tool-0.0.4.tar.gz.
File metadata
- Download URL: function_tool-0.0.4.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e37a20265f78cbc665f516d28e32d45cac83efdde4c6d4635c1d49dfc2bad2e6
|
|
| MD5 |
9ce59c1bbb66f51bd9c58c213f7631a1
|
|
| BLAKE2b-256 |
8e9eeaa543d2b007d883de71725628821c50e3c26b926757e5784d00234334de
|
File details
Details for the file function_tool-0.0.4-py3-none-any.whl.
File metadata
- Download URL: function_tool-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2de5466b7c1379d61a886025267e41cd243e06ecda6a8fe2de852ebc54410b1
|
|
| MD5 |
4903ce7dd578c66100b883be41e545ad
|
|
| BLAKE2b-256 |
7883f1e90ba2badab932b9c3efa6908c83b34fd8795fca6f48999fb29c0e9f02
|