Skip to main content

Common Tools

Project description

# 前置安装twine
python -m pip install --upgrade twine
# 检查
python setup.py check

# 打包
python setup.py sdist bdist_wheel

# 上传
twine upload dist/*
# 安装使用
pip install PyGaLiTool
pip install PyGaLiTool==0.0.3
# 使用方式
from pygali.date_utils import cur_date
print(cur_date())
# 一些常见用法:
# cur_date
cur_date()
cur_date("%Y%m%d")
cur_date(DatePattern.CHINESE_DATE_FORMAT)

# cur_datetime
cur_datetime()
cur_datetime("%Y%m%d%H%M%S")
cur_datetime(DatePattern.CHINESE_DATETIME_FORMAT)

# date_add/date_sub
date_sub(cur_date(), 1)
date_add(cur_date(), -1)
date_add(cur_date(), 1)

# cur_datetime_tz
cur_datetime_tz()
cur_datetime_tz("GMT-2")
cur_datetime_tz("GMT-8")

# date_format
date_format(cur_datetime(), "%Y-%m-%d")
date_format(cur_datetime(), "%Y-%m-%d %H")

# date_diff
date_diff('2024-10-10', '2024-10-01')

# ts_to_datetime
ts_to_datetime(int(time.time()), 'GMT-8')
ts_to_datetime(int(time.time()), 'Etc/GMT-8')
ts_to_datetime(int(time.time()), 'GMT+8')
ts_to_datetime(int(time.time()), 'GMT+2')

# parse_date, parse_datetime
parse_date('2024-08-29 12:34:56')
parse_datetime('2024-08-29 12:34:56')

# to_date, year, month, day_of_month
to_date('2024-08-29 12:34:56')
year('2024-08-29 12:34:56'), month('2024-08-29 12:34:56'), day_of_month('2024-08-29 12:34:56')
hour('2024-08-29 12:34:56'), minute('2024-08-29 12:34:56'), second('2024-08-29 12:34:56')

# last_month, next_month, last_year, next_year
last_month('2024-01-01 12:34:56')
next_month('2024-12-01 12:34:56')

# begin_date_of_month, end_date_of_month
begin_date_of_month('2024-08-10 12:34:56')
end_date_of_month('2024-08-10 12:34:56')

# begin_date_of_month_offset, end_date_of_month_offset
begin_date_of_month_offset('2024-08-31 12:34:56', -1)
end_date_of_month_offset('2024-08-31 12:34:56', -1)
begin_date_of_month_offset('2024-08-31 12:34:56', 1)
end_date_of_month_offset('2024-08-31 12:34:56', 1)

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

PyGaLiTool-0.0.6.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

PyGaLiTool-0.0.6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file PyGaLiTool-0.0.6.tar.gz.

File metadata

  • Download URL: PyGaLiTool-0.0.6.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.8

File hashes

Hashes for PyGaLiTool-0.0.6.tar.gz
Algorithm Hash digest
SHA256 9a7275a02132c0813e3fe0f99c72d915443477436515b7788805b50890024ef1
MD5 d35b28ce05f32b07a4ecbacd49157beb
BLAKE2b-256 5908241f964e7813753605fe73484aa3c6b46e95ce0f2843d9a1d4e4bacf0002

See more details on using hashes here.

File details

Details for the file PyGaLiTool-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: PyGaLiTool-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.8

File hashes

Hashes for PyGaLiTool-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9f43122540138717ccebabd80159d11d22a11211903673a28626eaf5016385b0
MD5 24caca0b184d701ed2bdfb046a4b581a
BLAKE2b-256 6e234c1993656149c0673ddba7b9a9ccee3269cb4fb5814296acf4ac1c0fc30e

See more details on using hashes here.

Supported by

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