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 hashes)
Built Distribution
Close
Hashes for function_tool-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2de5466b7c1379d61a886025267e41cd243e06ecda6a8fe2de852ebc54410b1 |
|
MD5 | 4903ce7dd578c66100b883be41e545ad |
|
BLAKE2b-256 | 7883f1e90ba2badab932b9c3efa6908c83b34fd8795fca6f48999fb29c0e9f02 |