화살표 날짜/시간
인간 친화적인 시간 형식 지정 및 이동.
개요
표준 Python 날짜/시간 구문 분석에 지능형 래퍼를 제공합니다.
단순화된 교대 및 사람이 읽을 수 있는 문자열 형식을 크게 허용합니다.
코드 및 실행 출력
복잡한 문자열을 구문 분석하고 기본 UTC 변형을 추정합니다.
arrow_demo.py
에디터에서 사용해 보세요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 로그 평가
- 데이터베이스 타임스탬프 변형