アロー日時

人間に優しい時刻のフォーマットとシフト。

エディターで試してみる

概要

標準の Python 日時解析に対するインテリジェントなラッパーを提供します。

簡素化されたシフトと人間が判読できる文字列形式を大幅に許可します。

コードと実行の出力

複雑な文字列を解析し、ネイティブ UTC バリアントを推定します。

import arrow

# Current UTC time
now = arrow.utcnow()
print(f"Now (UTC): {now.format('YYYY-MM-DD HH:mm:ss')}")

# Shift time forward
future = now.shift(days=14, hours=6)
print(f"Release date: {future.humanize()}")
print(f"Exact date:   {future.format('dddd, MMMM Do YYYY')}")

# Parse chaotic string
parsed = arrow.get("2025-07-04T12:00:00-04:00")
print(f"\nParsed US/Eastern: {parsed}")

# Convert across timezones
import pytz
zones = ['Asia/Tokyo', 'Europe/London', 'America/New_York']
print("\nFuture Date around the world:")
for tz_name in zones:
    tz = pytz.timezone(tz_name)
    local_dt = future.datetime.astimezone(tz)
    print(f"  {tz_name:<25} {local_dt.strftime('%Y-%m-%d %H:%M %Z')}")
端子出力
Now (UTC): 2025-XX-XX XX:XX:XX
Release date: in 14 days
Exact date:   ...

段階的な実装

  • タイムゾーンの変換
  • CRONログの評価
  • データベースのタイムスタンプの変更

よくある質問

関連トピック