Arrow is a Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps. It implements and updates the datetime type, plugging gaps in functionality and providing an intelligent module API that supports many common creation scenarios. Simply put, it helps you work with dates and times with fewer imports and a lot less code.
Python's standard library and some other low-level modules have near-complete date, time and timezone functionality, but don't work very well from a usability perspective:
shiftmethod with support for relative offsets, including weeks
$ pip install -U arrow
>>> import arrow >>> arrow.get('2013-05-11T21:23:58.970460+07:00') <Arrow [2013-05-11T21:23:58.970460+07:00]> >>> utc = arrow.utcnow() >>> utc <Arrow [2013-05-11T21:23:58.970460+00:00]> >>> utc = utc.shift(hours=-1) >>> utc <Arrow [2013-05-11T20:23:58.970460+00:00]> >>> local = utc.to('US/Pacific') >>> local <Arrow [2013-05-11T13:23:58.970460-07:00]> >>> local.timestamp() 1368303838.970460 >>> local.format() '2013-05-11 13:23:58 -07:00' >>> local.format('YYYY-MM-DD HH:mm:ss ZZ') '2013-05-11 13:23:58 -07:00' >>> local.humanize() 'an hour ago' >>> local.humanize(locale='ko-kr') ' '
For full documentation, please visit arrow.readthedocs.io.
Contributions are welcome for both code and localizations (adding and updating locales). Begin by gaining familiarity with the Arrow library and its features. Then, jump into contributing:
tox && tox -e lint,docs(if you have tox installed) OR
make build39 && make test && make lint(if you do not have Python 3.9 installed, replace
build39with the latest Python version on your system).
If you have any questions along the way, feel free to ask them here.
Open Collective is an online funding platform that provides tools to raise money and share your finances with full transparency. It is the platform of choice for individuals and companies to make one-time or recurring donations directly to the project. If you are interested in making a financial contribution, please visit the Arrow collective.