{"id":22712859,"url":"https://github.com/dgilland/zulu","last_synced_at":"2025-08-07T17:31:42.563Z","repository":{"id":57478653,"uuid":"63566330","full_name":"dgilland/zulu","owner":"dgilland","description":"A drop-in replacement for native Python datetimes that embraces UTC.","archived":false,"fork":false,"pushed_at":"2023-11-20T16:30:45.000Z","size":392,"stargazers_count":60,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-28T23:17:08.969Z","etag":null,"topics":["date","datetime","python","python3","time","timedelta","utc"],"latest_commit_sha":null,"homepage":"https://zulu.readthedocs.io","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/dgilland.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE.rst","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-18T03:09:07.000Z","updated_at":"2024-01-15T16:41:34.000Z","dependencies_parsed_at":"2024-06-19T00:22:20.307Z","dependency_job_id":"d08944f7-2871-45e0-ae49-ff30071dda75","html_url":"https://github.com/dgilland/zulu","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgilland%2Fzulu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgilland%2Fzulu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgilland%2Fzulu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgilland%2Fzulu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgilland","download_url":"https://codeload.github.com/dgilland/zulu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229070360,"owners_count":18015437,"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","python3","time","timedelta","utc"],"created_at":"2024-12-10T13:39:33.582Z","updated_at":"2024-12-10T13:39:34.119Z","avatar_url":"https://github.com/dgilland.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"zulu\n****\n\n|version| |build| |coveralls| |license|\n\n\nA drop-in replacement for native datetimes that embraces UTC\n\n\nLinks\n=====\n\n- Project: https://github.com/dgilland/zulu\n- Documentation: https://zulu.readthedocs.io\n- PyPI: https://pypi.python.org/pypi/zulu/\n- Github Actions: https://github.com/dgilland/zulu/actions\n\n\nFeatures\n========\n\n- All datetime objects converted and stored as UTC.\n- Parses ISO8601 formatted strings and POSIX timestamps by default.\n- Timezone representation applied only during string output formatting or when casting to native datetime object.\n- Drop-in replacement for native datetime objects.\n- Python 3.6+\n\n\nQuickstart\n==========\n\nInstall using pip:\n\n\n::\n\n    pip3 install zulu\n\n\n.. code-block:: python\n\n    import zulu\n\n    zulu.now()\n    # \u003cZulu [2016-07-25T19:33:18.137493+00:00]\u003e\n\n    dt = zulu.parse('2016-07-25T19:33:18.137493+00:00')\n    # \u003cZulu [2016-07-25T19:33:18.137493+00:00]\u003e\n\n    dt = zulu.create(2016, 7, 25, 19, 33, 18, 137493)\n    # \u003cZulu [2016-07-25T19:33:18.137493+00:00]\u003e\n\n    dt.isoformat()\n    # '2016-07-25T19:33:18.137493+00:00'\n\n    dt.timestamp()\n    # 1469475198.137493\n\n    dt.naive\n    # datetime.datetime(2016, 7, 25, 19, 33, 18, 137493)\n\n    dt.datetime\n    # datetime.datetime(2016, 7, 25, 19, 33, 18, 137493, tzinfo=\u003cUTC\u003e)\n\n    dt.format('%Y-%m-%d')\n    # 2016-07-25\n\n    dt.format('YYYY-MM-dd')\n    # 2016-07-25\n\n    dt.format(\"E, MMM d, ''YY\")\n    # \"Mon, Jul 25, '16\"\n\n    dt.format(\"E, MMM d, ''YY\", locale='de')\n    # \"Mo., Juli 25, '16\"\n\n    dt.format(\"E, MMM d, ''YY\", locale='fr')\n    # \"lun., juil. 25, '16\"\n\n    dt.shift(hours=-5, minutes=10)\n    # \u003cZulu [2016-07-25T14:43:18.137493+00:00]\u003e\n\n    dt.replace(hour=14, minute=43)\n    # \u003cZulu [2016-07-25T14:43:18.137493+00:00]\u003e\n\n    dt.start_of('day')\n    # \u003cZulu [2016-07-25T00:00:00+00:00]\u003e\n\n    dt.end_of('day')\n    # \u003cZulu [2016-07-25T23:59:59.999999+00:00]\u003e\n\n    dt.span('hour')\n    # (\u003cZulu [2016-07-25T19:00:00+00:00]\u003e, \u003cZulu [2016-07-25T19:59:59.999999+00:00]\u003e)\n\n    dt.time_from(dt.end_of('day'))\n    # '4 hours ago'\n\n    dt.time_to(dt.end_of('day'))\n    # 'in 4 hours'\n\n    list(zulu.range('hour', dt, dt.shift(hours=4)))\n    # [Zulu [2016-07-25T19:33:18.137493+00:00]\u003e,\n    #  Zulu [2016-07-25T20:33:18.137493+00:00]\u003e,\n    #  Zulu [2016-07-25T21:33:18.137493+00:00]\u003e,\n    #  Zulu [2016-07-25T22:33:18.137493+00:00]\u003e]\n\n    list(zulu.span_range('minute', dt, dt.shift(minutes=4)))\n    # [(Zulu [2016-07-25T19:33:00+00:00]\u003e, Zulu [2016-07-25T19:33:59.999999+00:00]\u003e),\n    #  (Zulu [2016-07-25T19:34:00+00:00]\u003e, Zulu [2016-07-25T19:34:59.999999+00:00]\u003e),\n    #  (Zulu [2016-07-25T19:35:00+00:00]\u003e, Zulu [2016-07-25T19:35:59.999999+00:00]\u003e),\n    #  (Zulu [2016-07-25T19:36:00+00:00]\u003e, Zulu [2016-07-25T19:36:59.999999+00:00]\u003e)]\n\n    zulu.parse_delta('1w 3d 2h 32m')\n    # \u003cDelta [10 days, 2:32:00]\u003e\n\n    zulu.parse_delta('2:04:13:02.266')\n    # \u003cDelta [2 days, 4:13:02.266000]\u003e\n\n    zulu.parse_delta('2 days, 5 hours, 34 minutes, 56 seconds')\n    # \u003cDelta [2 days, 5:34:56]\u003e\n\n\nWhy Zulu?\n=========\n\nWhy zulu instead of `native datetimes \u003chttps://docs.python.org/3.5/library/datetime.html#datetime-objects\u003e`_:\n\n- Zulu has extended datetime features such as ``parse()``, ``format()``, ``shift()``, and `python-dateutil`_ timezone support.\n- Parses ISO8601 and timestamps by default without any extra arguments.\n- Easier to reason about ``Zulu`` objects since they are only ever UTC datetimes.\n- Clear delineation between UTC and other time zones where timezone representation is only applicable for display or conversion to native datetime.\n- Supports more string parsing/formatting options using `Unicode date patterns`_ as well as ``strptime/strftime`` directives.\n\n\nWhy zulu instead of `Arrow`_:\n\n- Zulu is a drop-in replacement for native datetimes (inherits from ``datetime.datetime``). No need to convert using ``arrow.datetime`` when you need a datetime (zulu is always a datetime).\n- Stricter parsing to avoid silent errors. For example, one might expect ``arrow.get('02/08/1987', 'MM/DD/YY')`` to fail (input does not match format) but it gladly returns ``\u003cArrow [2019-02-08T00:00:00+00:00)`` whereas ``zulu.parse('02/08/1987', '%m/%d/%y')`` throws ``zulu.parser.ParseError: Value \"02/08/1987\" does not match any format in ['%m/%d/%y']``.\n- Avoids timezone/DST shifting bugs by only dealing with UTC datetimes when applying timedeltas or performing other calculations.\n- Supports ``strptime/strftime`` as well as `Unicode date patterns`_ for string parsing/formatting.\n\n\nSpecial Thanks\n==============\n\nSpecial thanks goes out to the authors/contributors of the following libraries that have made it possible for ``zulu`` to exist:\n\n- `Babel`_\n- `iso8601`_\n- `python-dateutil`_\n- `pytimeparse`_\n- `pytz`_\n\n\nFor the full documentation, please visit https://zulu.readthedocs.io.\n\n\n\n.. _Unicode date patterns: http://www.unicode.org/reports/tr35/tr35-19.html#Date_Field_Symbol_Table\n.. _Arrow: https://arrow.readthedocs.io\n.. _Babel: https://github.com/python-babel/babel\n.. _iso8601: https://bitbucket.org/micktwomey/pyiso8601\n.. _python-dateutil: https://github.com/dateutil/dateutil\n.. _pytimeparse: https://github.com/wroberts/pytimeparse\n.. _pytz: http://pythonhosted.org/pytz\n\n.. |version| image:: https://img.shields.io/pypi/v/zulu.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/zulu/\n\n.. |build| image:: https://img.shields.io/github/actions/workflow/status/dgilland/zulu/main.yml?branch=master\u0026style=flat-square\n    :target: https://github.com/dgilland/zulu/actions\n\n.. |coveralls| image:: https://img.shields.io/coveralls/dgilland/zulu/master.svg?style=flat-square\n    :target: https://coveralls.io/r/dgilland/zulu\n\n.. |license| image:: https://img.shields.io/pypi/l/zulu.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/zulu/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgilland%2Fzulu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgilland%2Fzulu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgilland%2Fzulu/lists"}