The python3 tool classes
Project description
ph-utils
The python3 tool classes.
- Install
pip install ph-utils
- Usage
from ph_utils import date_utils
# date_utils.parse()
from ph_utils.date_utils import parse
# parse()
date-utils
The date processing tool.
1. parse(date_data: Any, fmt=None): datetime
You can parse various data formats into date objects, including time stamps, strings, and date objects themselves. Return datetime object.
- parse timestamp
date_utils.parse(1691997308) # 2023-08-14 15:15:08
- parse strings
date_utils.parse('2023-08-14 15:23:23') # 2023-08-14 15:23:23
date_utils.parse('20230814 152323') # 2023-08-14 15:23:23
date_utils.parse('2023/08/14 15:23:23', '%Y/%m/%d %H:%M:%S') # 2023-08-14 15:23:23
- parse
Noneobject
date_utils.parse() # 2023-08-14 15:15:23.830691
date_utils.parse(None) # 2023-08-14 15:15:23.830691
- parse
datetime
date_utils.parse(date_utils.parse()) # 2023-08-14 15:19:48.382871
2. format(ori_date, pattern): str
Date formatting is the process of converting a date to a specific format.
Parameter description:
ori_date: optional All parameters that can be supported by theparsefunction.pattern: optionaldefault: %Y-%m-%d, eg:%Y-%m-%d %H:%M:%S
date_utils.format(None, '%Y-%m-%d %H:%M:%S')
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
ph_utils-0.0.1.tar.gz
(8.4 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 ph_utils-0.0.1.tar.gz.
File metadata
- Download URL: ph_utils-0.0.1.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f131f1d7b7469d7e46d5d1311e586921120179f7edf56c01f7ba74c73abc2d8c
|
|
| MD5 |
5ac96e6c78b8a575f33dfb443046c3c2
|
|
| BLAKE2b-256 |
52c0e3dffb4b41efa6ed0fb87e64dcea39a316df011a3489d876aa4a97373297
|
File details
Details for the file ph_utils-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ph_utils-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c873bbaf84e477862f5ba8ef0fc11d86e55dc068bee021b68870ac9b6649c24
|
|
| MD5 |
6a5d9a152cf73bdaf05240bbc019e4b0
|
|
| BLAKE2b-256 |
7ebc7e948fa71984632beb94efde24bb7a3e7947b1d1eb1305c64635f932aad6
|