Skip to main content

The python3 tool classes

Project description

ph-utils

The python3 tool classes.

  1. Install
pip install ph-utils
  1. 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.

  1. parse timestamp
date_utils.parse(1691997308) # 2023-08-14 15:15:08
  1. 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
  1. parse None object
date_utils.parse() # 2023-08-14 15:15:23.830691
date_utils.parse(None) # 2023-08-14 15:15:23.830691
  1. 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:

  1. ori_date: optional All parameters that can be supported by the parse function.
  2. pattern: optional default: %Y-%m-%d, eg: %Y-%m-%d %H:%M:%S
date_utils.format(None, '%Y-%m-%d %H:%M:%S')

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ph_utils-0.0.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

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

Hashes for ph_utils-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f131f1d7b7469d7e46d5d1311e586921120179f7edf56c01f7ba74c73abc2d8c
MD5 5ac96e6c78b8a575f33dfb443046c3c2
BLAKE2b-256 52c0e3dffb4b41efa6ed0fb87e64dcea39a316df011a3489d876aa4a97373297

See more details on using hashes here.

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

Hashes for ph_utils-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c873bbaf84e477862f5ba8ef0fc11d86e55dc068bee021b68870ac9b6649c24
MD5 6a5d9a152cf73bdaf05240bbc019e4b0
BLAKE2b-256 7ebc7e948fa71984632beb94efde24bb7a3e7947b1d1eb1305c64635f932aad6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page