arrow
UtilitiesHuman-friendly dates
What is arrow?
Arrow is a Python library that offers a human-friendly approach to creating, manipulating, formatting, and converting dates and times. It works as a drop-in replacement for datetime with a simpler API, timezone-aware by default, and intuitive time-shifting methods like .shift(days=-1) and .humanize().
In PyRun, Arrow is available via micropip. You can explore date arithmetic, timezone conversions, relative time formatting, and date parsing without wading through Python's standard datetime boilerplate — all in your browser with no setup required.
Code Example
Human-friendly timezone conversion and time shifting.
import arrow
now = arrow.now()
print("Now (local):", now.format("YYYY-MM-DD HH:mm:ss ZZ"))
print("Now (UTC) :", now.to("UTC").format("YYYY-MM-DD HH:mm:ss"))
past = now.shift(days=-10, hours=-3)
print("\n10 days 3 hrs ago:", past.humanize())
dt = arrow.get("2025-07-04 12:00:00", "YYYY-MM-DD HH:mm:ss", tzinfo="US/Eastern")
print("\nNew York :", dt.format("YYYY-MM-DD HH:mm ZZ"))
print("Tokyo :", dt.to("Asia/Tokyo").format("YYYY-MM-DD HH:mm ZZ"))
print("Mumbai :", dt.to("Asia/Kolkata").format("YYYY-MM-DD HH:mm ZZ"))Why run arrow in PyRun?
- ✦ Zero setup — no pip install, no virtual environment, no Python download
- ✦ Instant results — powered by WebAssembly, runs locally in your browser
- ✦ Share your code — generate a link and anyone can run it instantly
- ✦ Works offline — after first load, PyRun runs without internet
Related Packages
Recommended Python Resources
Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.
Python Loops
Learn how to use Python loops to iterate over data. Master for loops, while loops, break, continue, and loop best practices with interactive examples.
How to Sort a List in Python
Learn how to sort a list in Python using the sort() method and the sorted() function. Discover custom key sorting and reverse order examples.
Python String Methods
A complete reference guide for Python string manipulation. Master formatting, searching, splitting, replacing, and checking string properties.
Python vs JavaScript: Which Programming Language is Best?
A comprehensive comparison between Python and JavaScript. Explore syntax differences, performance, use cases (backend vs frontend), and coding examples.