{"id":22862432,"url":"https://github.com/tomi77/python-t77-date","last_synced_at":"2025-06-23T13:36:58.447Z","repository":{"id":57473043,"uuid":"48335679","full_name":"tomi77/python-t77-date","owner":"tomi77","description":"A set of functions related with dates","archived":false,"fork":false,"pushed_at":"2017-06-14T06:31:40.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T05:27:55.565Z","etag":null,"topics":["date","datetime","python","time","timedelta","timezone-conversion"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomi77.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-20T20:15:10.000Z","updated_at":"2017-06-13T21:10:42.000Z","dependencies_parsed_at":"2022-09-26T17:40:45.430Z","dependency_job_id":null,"html_url":"https://github.com/tomi77/python-t77-date","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/tomi77/python-t77-date","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomi77%2Fpython-t77-date","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomi77%2Fpython-t77-date/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomi77%2Fpython-t77-date/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomi77%2Fpython-t77-date/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomi77","download_url":"https://codeload.github.com/tomi77/python-t77-date/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomi77%2Fpython-t77-date/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261487521,"owners_count":23166103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["date","datetime","python","time","timedelta","timezone-conversion"],"created_at":"2024-12-13T10:13:32.393Z","updated_at":"2025-06-23T13:36:53.426Z","avatar_url":"https://github.com/tomi77.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"python-t77-date\n===============\n\n.. image:: https://travis-ci.org/tomi77/python-t77-date.svg?branch=master\n   :target: https://travis-ci.org/tomi77/python-t77-date\n.. image:: https://coveralls.io/repos/github/tomi77/python-t77-date/badge.svg?branch=master\n   :target: https://coveralls.io/github/tomi77/python-t77-date?branch=master\n.. image:: https://codeclimate.com/github/tomi77/python-t77-date/badges/gpa.svg\n   :target: https://codeclimate.com/github/tomi77/python-t77-date\n   :alt: Code Climate\n\nA set of functions related with dates\n\nInstallation\n------------\n\nInstall via ``pip``\n\n.. sourcecode:: sh\n\n   pip install t77_date\n\ndatetime module\n---------------\n\nA set of ``datetime.datetime`` and ``datetime.date`` related functions.\n\nstart_of_day\n~~~~~~~~~~~~\n\nReturn a new ``datetime.datetime`` object with values that represent a start of a day.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e dt = datetime(2016, 7, 2, 21, 49, 12)\n   \u003e\u003e\u003e sod = start_of_day(dt)\n   \u003e\u003e\u003e print(sod)\n   2016-07-02 00:00:00\n\nend_of_day\n~~~~~~~~~~\n\nReturn a new ``datetime.datetime`` object with values that represent a end of a day.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e dt = datetime(2016, 7, 2, 21, 49, 12)\n   \u003e\u003e\u003e eod = end_of_day(now)\n   \u003e\u003e\u003e print(eod)\n   2016-07-02 23:59:59.999999\n\nstart_of_month\n~~~~~~~~~~~~~~\n\nReturn a new ``datetime.datetime`` object with values that represent a start of a month.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e dt = datetime(2016, 7, 2, 21, 49, 12)\n   \u003e\u003e\u003e som = start_of_month(dt)\n   \u003e\u003e\u003e print(som)\n   2016-07-01 00:00:00\n\nend_of_month\n~~~~~~~~~~~~\n\nReturn a new ``datetime.datetime`` object with values that represent a end of a month.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e dt = datetime(2016, 7, 2, 21, 49, 12)\n   \u003e\u003e\u003e eom = end_of_day(now)\n   \u003e\u003e\u003e print(eom)\n   2016-07-31 23:59:59.999999\n\nset_next_week_day\n~~~~~~~~~~~~~~~~~\n\nSet week day.\nNew date will be greater or equal than input date.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e saturday = datetime(2016, 7, 2, 21, 49, 12)\n   \u003e\u003e\u003e next_friday = set_next_week_day(saturday, ISO_FRIDAY, iso=True)\n   \u003e\u003e\u003e print(next_friday)\n   2016-07-08 21:49:12\n   \u003e\u003e\u003e next_friday = set_next_week_day(saturday, FRIDAY, iso=False)\n   \u003e\u003e\u003e print(next_friday)\n   2016-07-08 21:49:12\n\nset_prev_week_day\n~~~~~~~~~~~~~~~~~\n\nSet week day.\nNew date will be less or equal than input date.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e saturday = datetime(2016, 7, 2, 12)\n   \u003e\u003e\u003e prev_friday = set_prev_week_day(saturday, ISO_FRIDAY, iso=True)\n   \u003e\u003e\u003e print(prev_friday)\n   2016-07-01 21:49:12\n   \u003e\u003e\u003e prev_friday = set_prev_week_day(saturday, FRIDAY, iso=False)\n   \u003e\u003e\u003e print(prev_friday)\n   2016-07-01 21:49:12\n\ntime module\n-----------\n\nA set of ``datetime.time`` related functions.\n\ndiff_time\n~~~~~~~~~\n\nCalculates ``datetime.timedelta`` between two ``datetime.time`` values.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e t1, t2 = time(hour=1), time(hour=2)\n   \u003e\u003e\u003e print(diff_time(t2, t1))\n   1:00:00\n   \u003e\u003e\u003e print(diff_time(t1, t2))\n   -1 day, 23:00:00\n\ntimedelta module\n----------------\n\nA set of ``datetime.timedelta`` related functions.\n\ntimedelta_to_seconds\n~~~~~~~~~~~~~~~~~~~~\n\nConvert ``datetime.timedelta`` to seconds.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e td = timedelta(days=1, microseconds=1)\n   \u003e\u003e\u003e seconds = timedelta_to_seconds(td)\n   \u003e\u003e\u003e print(seconds)\n   86400\n   \u003e\u003e\u003e seconds = timedelta_to_seconds(td, with_microseconds=True)\n   \u003e\u003e\u003e print(seconds)\n   86400.000001\n\ntimedelta_to_str\n~~~~~~~~~~~~~~~~\n\nString representation of ``datetime.timedelta``.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e td = timedelta(days=5, microseconds=1)\n   \u003e\u003e\u003e td_str = timedelta_to_str(td)\n   \u003e\u003e\u003e print(td_str)\n   '120:00:00'\n   \u003e\u003e\u003e td_str = timedelta_to_str(val, with_microseconds=True)\n   \u003e\u003e\u003e print(td_str)\n   '120:00:00.000001'\n\nparse_timedelta\n~~~~~~~~~~~~~~~\n\nParses a string and return a ``datetime.timedelta``.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e value = '1:11:12.13'\n   \u003e\u003e\u003e td = parse_timedelta(value)\n   \u003e\u003e\u003e print(td)\n   1:11:12.000013\n   \u003e\u003e\u003e value = '1 day, 10:11:12.13'\n   \u003e\u003e\u003e td = parse_timedelta(value)\n   \u003e\u003e\u003e print(td)\n   1 day, 1:11:12.000013\n\ntz module\n---------\n\nA set of ``dateutil.tz`` related functions.\n\nto_utc\n~~~~~~\n\nConvert ``datetime.datetime`` to UTC.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e d1 = datetime.now(tz=tzlocal())\n   \u003e\u003e\u003e d2 = to_utc(d1)\n   \u003e\u003e\u003e print(d1)\n   2017-02-20 13:19:36.511822+01:00\n   \u003e\u003e\u003e print(d2)\n   2017-02-20 12:19:36.511822+00:00\n\nto_local\n~~~~~~~~\n\nConvert ``datetime.datetime`` to local time zone.\n\nExample\n\n.. sourcecode:: python\n\n   \u003e\u003e\u003e d1 = datetime.now(tz=tzutc())\n   \u003e\u003e\u003e d2 = to_local(d1)\n   \u003e\u003e\u003e print(d1)\n   2017-02-20 12:19:36.511822+00:00\n   \u003e\u003e\u003e print(d2)\n   2017-02-20 13:19:36.511822+01:00\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomi77%2Fpython-t77-date","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomi77%2Fpython-t77-date","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomi77%2Fpython-t77-date/lists"}