import arrow
# 取得當下時間
print('現在時間', arrow.now())
print('UTC時間', arrow.utcnow())
# 時間形式轉換
print('時間(格式化):', arrow.now().format("YYYY-MM-DD HH:mm:ss"))
print('時間戳:', arrow.now().timestamp)
print('字串轉為 arrow 物件', arrow.get("2018-10-03 09:45:55", "YYYY-MM-DD HH:mm:ss"))
print('時間戳轉為 arrow 物件:', arrow.get("1538531139.0"))
# 直接產生 arrow 物件
print('直接產生 arrow 物件:', arrow.Arrow(2018, 10, 3))
# 時間推移
t = arrow.now()
print('前一天:', t.shift(days=-1))
print('前一周:', t.shift(weeks=-1))
print('前一月:', t.shift(months=-1))
print('前一年:', t.shift(years=-1))
print('前一小時:', t.shift(hours=-1))
print('人性化描述:', t.shift(hours=-1).humanize(locale='zh_tw'))