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.
Arrow Date & Time
Try in Editorimport 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