```
# 前置安装twine
python -m pip install --upgrade twine
```
```
# 检查
python setup.py check
# 打包
python setup.py sdist bdist_wheel
# 上传
twine upload dist/*
```
```shell
# 安装使用
pip install PyGaLiTool
pip install PyGaLiTool==0.0.3
```
```python
# 使用方式
from pygali.date_utils import cur_date
print(cur_date())
```
```python
# 一些常见用法:
# 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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/xuranyang/PyGaLiTool",
"name": "PyGaLiTool",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "tool",
"author": "xuranyang",
"author_email": "xuranyang96@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/59/08/241f964e7813753605fe73484aa3c6b46e95ce0f2843d9a1d4e4bacf0002/PyGaLiTool-0.0.6.tar.gz",
"platform": null,
"description": "\n```\n# \u524d\u7f6e\u5b89\u88c5twine\npython -m pip install --upgrade twine\n```\n\n```\n# \u68c0\u67e5\npython setup.py check\n\n# \u6253\u5305\npython setup.py sdist bdist_wheel\n\n# \u4e0a\u4f20\ntwine upload dist/*\n```\n\n```shell\n# \u5b89\u88c5\u4f7f\u7528\npip install PyGaLiTool\npip install PyGaLiTool==0.0.3\n```\n\n```python\n# \u4f7f\u7528\u65b9\u5f0f\nfrom pygali.date_utils import cur_date\nprint(cur_date())\n```\n\n```python\n# \u4e00\u4e9b\u5e38\u89c1\u7528\u6cd5:\n# cur_date\ncur_date()\ncur_date(\"%Y%m%d\")\ncur_date(DatePattern.CHINESE_DATE_FORMAT)\n\n# cur_datetime\ncur_datetime()\ncur_datetime(\"%Y%m%d%H%M%S\")\ncur_datetime(DatePattern.CHINESE_DATETIME_FORMAT)\n\n# date_add/date_sub\ndate_sub(cur_date(), 1)\ndate_add(cur_date(), -1)\ndate_add(cur_date(), 1)\n\n# cur_datetime_tz\ncur_datetime_tz()\ncur_datetime_tz(\"GMT-2\")\ncur_datetime_tz(\"GMT-8\")\n\n# date_format\ndate_format(cur_datetime(), \"%Y-%m-%d\")\ndate_format(cur_datetime(), \"%Y-%m-%d %H\")\n\n# date_diff\ndate_diff('2024-10-10', '2024-10-01')\n\n# ts_to_datetime\nts_to_datetime(int(time.time()), 'GMT-8')\nts_to_datetime(int(time.time()), 'Etc/GMT-8')\nts_to_datetime(int(time.time()), 'GMT+8')\nts_to_datetime(int(time.time()), 'GMT+2')\n\n# parse_date, parse_datetime\nparse_date('2024-08-29 12:34:56')\nparse_datetime('2024-08-29 12:34:56')\n\n# to_date, year, month, day_of_month\nto_date('2024-08-29 12:34:56')\nyear('2024-08-29 12:34:56'), month('2024-08-29 12:34:56'), day_of_month('2024-08-29 12:34:56')\nhour('2024-08-29 12:34:56'), minute('2024-08-29 12:34:56'), second('2024-08-29 12:34:56')\n\n# last_month, next_month, last_year, next_year\nlast_month('2024-01-01 12:34:56')\nnext_month('2024-12-01 12:34:56')\n\n# begin_date_of_month, end_date_of_month\nbegin_date_of_month('2024-08-10 12:34:56')\nend_date_of_month('2024-08-10 12:34:56')\n\n# begin_date_of_month_offset, end_date_of_month_offset\nbegin_date_of_month_offset('2024-08-31 12:34:56', -1)\nend_date_of_month_offset('2024-08-31 12:34:56', -1)\nbegin_date_of_month_offset('2024-08-31 12:34:56', 1)\nend_date_of_month_offset('2024-08-31 12:34:56', 1)\n```\n\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "Common Tools",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/xuranyang/PyGaLiTool"
},
"split_keywords": [
"tool"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6e234c1993656149c0673ddba7b9a9ccee3269cb4fb5814296acf4ac1c0fc30e",
"md5": "24caca0b184d701ed2bdfb046a4b581a",
"sha256": "9f43122540138717ccebabd80159d11d22a11211903673a28626eaf5016385b0"
},
"downloads": -1,
"filename": "PyGaLiTool-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "24caca0b184d701ed2bdfb046a4b581a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4974,
"upload_time": "2024-08-29T12:41:09",
"upload_time_iso_8601": "2024-08-29T12:41:09.844627Z",
"url": "https://files.pythonhosted.org/packages/6e/23/4c1993656149c0673ddba7b9a9ccee3269cb4fb5814296acf4ac1c0fc30e/PyGaLiTool-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5908241f964e7813753605fe73484aa3c6b46e95ce0f2843d9a1d4e4bacf0002",
"md5": "d35b28ce05f32b07a4ecbacd49157beb",
"sha256": "9a7275a02132c0813e3fe0f99c72d915443477436515b7788805b50890024ef1"
},
"downloads": -1,
"filename": "PyGaLiTool-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "d35b28ce05f32b07a4ecbacd49157beb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4937,
"upload_time": "2024-08-29T12:41:11",
"upload_time_iso_8601": "2024-08-29T12:41:11.343093Z",
"url": "https://files.pythonhosted.org/packages/59/08/241f964e7813753605fe73484aa3c6b46e95ce0f2843d9a1d4e4bacf0002/PyGaLiTool-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-29 12:41:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xuranyang",
"github_project": "PyGaLiTool",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "pygalitool"
}