{"id":37563022,"url":"https://github.com/serfend/sgtpyutils","last_synced_at":"2026-01-16T09:08:15.739Z","repository":{"id":40378765,"uuid":"500067475","full_name":"serfend/sgtpyutils","owner":"serfend","description":"sgtpyutils is a public library for use","archived":false,"fork":false,"pushed_at":"2025-04-02T02:45:23.000Z","size":411,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T20:06:11.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/sgtpyutils","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serfend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-05T10:37:44.000Z","updated_at":"2025-10-26T23:41:53.000Z","dependencies_parsed_at":"2024-10-18T05:55:03.077Z","dependency_job_id":null,"html_url":"https://github.com/serfend/sgtpyutils","commit_stats":null,"previous_names":[],"tags_count":82,"template":false,"template_full_name":null,"purl":"pkg:github/serfend/sgtpyutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serfend%2Fsgtpyutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serfend%2Fsgtpyutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serfend%2Fsgtpyutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serfend%2Fsgtpyutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serfend","download_url":"https://codeload.github.com/serfend/sgtpyutils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serfend%2Fsgtpyutils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-16T09:08:15.470Z","updated_at":"2026-01-16T09:08:15.642Z","avatar_url":"https://github.com/serfend.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Fserfend%2Fsgtpyutils%2F\"\u003e\u003cimg src=\"https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fserfend%2Fsgtpyutils%2F\u0026labelColor=%23697689\u0026countColor=%23ff8a65\u0026style=plastic\u0026labelStyle=none\" /\u003e\u003c/a\u003e \n    \u003ca href=\"https://pypi.python.org/pypi/sgtpyutils/\"\u003e\u003cimg alt=\"pypi version\" src=\"https://img.shields.io/pypi/v/sgtpyutils.svg\" /\u003e\u003c/a\u003e \n    \u003ca href=\"https://pypistats.org/packages/sgtpyutils\"\u003e\u003cimg alt=\"pypi download\" src=\"https://img.shields.io/pypi/dm/sgtpyutils.svg\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/serfend/sgtpyutils/releases\"\u003e\u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/release/serfend/sgtpyutils.svg?style=flat-square\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/serfend/sgtpyutils/releases\"\u003e\u003cimg alt=\"GitHub All Releases\" src=\"https://img.shields.io/github/downloads/serfend/sgtpyutils/total.svg?style=flat-square\u0026color=%2364ff82\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/serfend/sgtpyutils/commits\"\u003e\u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/serfend/sgtpyutils.svg?style=flat-square\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/serfend/sgtpyutils/actions/workflows/pytest.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status\" src=\"https://github.com/serfend/sgtpyutils/actions/workflows/pytest.yml/badge.svg\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\n\n![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge\u0026logo=windows\u0026logoColor=white)![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black)![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge\u0026logo=ubuntu\u0026logoColor=white)![Kali](https://img.shields.io/badge/Kali-268BEE?style=for-the-badge\u0026logo=kalilinux\u0026logoColor=white)![FreeBSD](https://img.shields.io/badge/-FreeBSD-%23870000?style=for-the-badge\u0026logo=freebsd\u0026logoColor=white)![Deepin](https://img.shields.io/badge/Deepin-007CFF?style=for-the-badge\u0026logo=deepin\u0026logoColor=white)![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge\u0026logo=debian\u0026logoColor=white)![Cent OS](https://img.shields.io/badge/cent%20os-002260?style=for-the-badge\u0026logo=centos\u0026logoColor=F0F0F0)\n\n# What?\n\nsgtpyutils is python module for common utils.\n\n\n\n## Install\n\n```shell\npip install sgtpyutils\n```\n\n\n\n## Usage\n\n### 日志处理\n```python\nfrom sgtpyutils.logger import logger\nlogger.debug('调试')\nlogger.info('信息')\nlogger.warning('警告')\n```\n\n### 时间处理\n```python\nfrom sgtpyutils.datetime import DateTime\n# 当前时间\nprint(DateTime()) # 2023-09-19 14:50:43.570560+08:00\n# 指定日期\nprint(DateTime('2023-09-19')) # 2023-09-19 00:00:00+08:00\n# 指定时间\nprint(DateTime('2023-09-19 14:50:43')) # 2023-09-19 14:50:43+08:00\n# 指定时间戳\nprint(DateTime(1695106243000)) # 2023-09-19 14:50:43+08:00\n# 指定时间及时区\nprint(DateTime('2023-09-19T14:50:43+07:00')) # 2023-09-19 14:50:43+07:00\n\n# 计算时间差\nprint((DateTime('2023-09-20') - '2023-09-19').total_seconds()) # 86400.0\nprint((DateTime('2023-09-20') - 60 * 1000)) # 2023-09-19 23:59:00+08:00\n\n# 获取相对时间\nprint(DateTime('2023-09-20').toRelativeTime('2023-09-20 14:23')) # 14小时前\nprint(DateTime('2023-09-20 10:00:00').toRelativeTime('2023-09-20 10:01:00')) # 1分钟后\nprint(DateTime('2023-01-20 10:00:00').toRelativeTime()) # xxx年前\n```\n\n\n\n\n\n## Status\n\n![Alt](https://repobeats.axiom.co/api/embed/af8eefa7ce843f622f7dafbfe1879a36f872474d.svg \"Repobeats analytics image\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserfend%2Fsgtpyutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserfend%2Fsgtpyutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserfend%2Fsgtpyutils/lists"}