--- id: pytimeparse version: "1.1.8" license: License :: OSI Approved :: MIT License license_treatment: permissive maintenance: active --- # pytimeparse — Time expression parser License: permissive · Maintenance: active · Popularity: top 1,000 on PyPI ## Install pip install pytimeparse uv add pytimeparse poetry add pytimeparse ## Description ===================================== pytimeparse: time expression parser ===================================== .. image:: https://travis-ci.org/wroberts/pytimeparse.svg?branch=master :target: https://travis-ci.org/wroberts/pytimeparse :alt: Travis CI build status .. image:: https://coveralls.io/repos/wroberts/pytimeparse/badge.svg :target: https://coveralls.io/r/wroberts/pytimeparse :alt: Test code coverage .. image:: https://img.shields.io/pypi/v/pytimeparse.svg :target: https://pypi.python.org/pypi/pytimeparse/ :alt: Latest Version Copyright (c) 2014 Will Roberts Licensed under the MIT License (see source file ``timeparse.py`` for details). A small Python library to parse various kinds of time expressions, inspired by `this StackOverflow question `_. The single function ``pytimeparse.timeparse.timeparse`` defined in the library (also available as ``pytimeparse.parse``) parses time expressions like the following: - ``32m`` - ``2h32m`` - ``3d2h32m`` - ``1w3d2h32m`` - ``1w 3d 2h 32m`` - ``1 w 3 d 2 h 32 m`` - ``4:13`` -... ## AI interpretation — verify before relying Parses human-readable time expressions (like '1w3d2h32m', '4:13:02', or '2 days, 5 hours') into seconds, returning an integer or float. Verdict: A lightweight, dependency-free parser for converting time expressions into seconds. MIT-licensed with active maintenance and no known vulnerabilities, making it suitable for straightforward time-parsing tasks in applications that need to accept human-readable duration input. [View on SkillFed](https://skillfed.io/packages/pytimeparse) · [View on PyPI](https://pypi.org/project/pytimeparse/)