Times is a small, minimalistic Python library for handling time conversions between universal time and arbitrary timezones. Version 0.7, the latest release, was rewritten to be implemented on top of the 'Arrow' library, providing a consistent interface while leveraging Arrow's capabilities. The project has not seen active development since around 2015.
pip install timesVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to convert local times to universal (UTC) and vice-versa, using string inputs or datetime objects, and how to format times for presentation in a specific timezone.
Migrate to `arrow` (recommended by `times` itself) or `datetime` with `zoneinfo` (Python 3.9+) / `pytz` for active maintenance and modern features. For example, `arrow.get(local_time_str_naive, 'Europe/Amsterdam').to('utc')`.Carefully manage whether your input datetime or string includes timezone information and adjust your `times.to_universal()` call accordingly. If `local_time` has `tzinfo`, omit the timezone argument. If a string has an offset, omit the timezone argument. Otherwise, provide it explicitly, e.g., `times.to_universal(naive_dt, 'Europe/Berlin')`.
For display purposes, prefer `times.format(universal_time, timezone, format_string)`. If you need a local datetime object for other operations, be aware of `pytz`'s limitations and consider working primarily in UTC until the final presentation or conversion step.