skillfed

timelib

parse english textual date descriptions

timelib v0.3.0 118.6K downloads/30d#12,114 on PyPI36
Permissive license zlib/php DORMANT released

What it is and what it does

timelib is a thin Python wrapper around PHP's internal timelib C module, exposing two main functions: strtodatetime() converts English-language date descriptions into Python datetime objects, and strtotime() converts them into Unix timestamps. It leverages PHP's battle-tested date parsing logic to handle relative expressions ("next friday", "4 hours ago"), absolute dates, and arithmetic ("29 feb 2008 -108 years").

The package has no runtime dependencies and ships as a compiled extension. It is dormant—last released in March 2023 with no active maintenance—but the repository remains public and unarchived. Install friction is medium because it requires a pre-built wheel matching your Python version and CPU architecture; source builds need a C compiler and PHP timelib headers.

Use it for:

  • Parse user-entered date strings in web forms or CLIs without requiring strict format specification
  • Convert relative time expressions ("3 days from now", "last month") into exact datetime objects for scheduling or logging
  • Migrate PHP date-parsing logic to Python while preserving the same parsing semantics
  • Build natural-language query interfaces that accept fuzzy date ranges and convert them to timestamps

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Parses natural-language date and time descriptions (like "next friday" or "4 hours ago") into Python datetime objects or Unix timestamps using PHP's timelib module.

Yes, if you need natural-language date parsing and can install a pre-built wheel for your platform. The permissive dual license and zero runtime dependencies make it lightweight. However, dormancy (last release March 2023, no active maintenance) means no bug fixes or Python version updates are forthcoming—verify wheel availability for your Python version and architecture before committing, and consider alternatives if you need ongoing support or broader platform coverage.

Install

timelib on PyPI

pip

pip install timelib

uv

uv add timelib

poetry

poetry add timelib

Installing timelib

Before you install

Medium install friction due to compiled extension (wheel available for cp39 on macOS arm64). Package is dormant—last release was 2023-03-18, last commit 2024-05-06; no active maintenance signal but repository remains public and unarchived.

License in practice

Dual-licensed under zlib/libpng and PHP License 3.01 (both permissive). You may use, modify, and redistribute freely in commercial and non-commercial contexts, provided you retain attribution and mark any alterations.

Quickstart

import timelib

# Parse natural language to datetime
dt = timelib.strtodatetime("next friday")
print(dt)  # datetime.datetime(2009, 6, 26, 0, 0)

# Parse to Unix timestamp
import time
ts = timelib.strtotime("4 hours ago")
print(time.ctime(ts))

Requires a pre-built wheel for your Python version and platform; source builds need the C extension toolchain and PHP timelib headers.

Verify before relying

  • Whether the package works with Python versions beyond 3.9 (python_support unspecified, only cp39 wheel evident)
  • Current compatibility with modern macOS/Linux/Windows architectures beyond the single arm64 wheel shown
  • Whether strtotime and strtodatetime handle timezone-aware parsing or always return naive datetimes

Package facts

License zlib/php (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance dormant — 1,245 days since the last release
Last repo commit
First released
Downloads 118,595/month — #12,114 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: timelib-0.3.0-cp39-cp39-macosx_12_0_arm64.whl

Tags

natural language date parsingenglish text to datetimerelative date expressionshuman-readable time stringsparse fuzzy datesstrtotime pythondate string parsing
date-parsingnatural-languagecompiled-extension

More Utilities packages