gitmyhub

arrow

Python ★ 9.0k updated 13d ago

🏹 Better dates & times for Python

A Python library that simplifies working with dates and times by replacing multiple confusing standard library modules with one clean API that handles timezones, formatting, parsing, and human-readable output like 'an hour ago'.

Pythonsetup: easycomplexity 2/5

Arrow is a Python library for working with dates and times in a simpler, cleaner way than Python's built-in tools allow. If you have ever written Python code that deals with dates or times and found yourself importing multiple modules and writing more code than felt necessary, Arrow is designed to fix that.

Python's standard library for handling dates involves several separate modules and several different types of objects, which can be confusing and verbose, especially when you need to work with timezones or convert between formats. Arrow replaces most of that with a single object and a cleaner way of doing common tasks.

With Arrow you can get the current time in any timezone with one line, shift a date forward or backward by hours, days, weeks, or months using a simple method, convert between timezones without boilerplate, and format or parse date strings without memorizing format codes. There is also a feature called humanize that turns a timestamp into a plain phrase like "an hour ago" or "in 3 days," and it supports many languages.

Installing Arrow is one command: pip install arrow. Once installed, you import a single module called arrow and use it to create, read, and manipulate dates. The library is fully compatible with Python's existing datetime type, so you can use it alongside code that already exists.

Arrow supports the ISO 8601 standard, which is the international format for writing dates and times. It can parse and generate ISO 8601 strings automatically, which matters if you are building apps that exchange data with APIs or other systems.

The project is open source, actively maintained, and accepts community contributions including support for additional languages in the humanize feature.

Where it fits