import arrow
import time
from datetime import datetime
#获得当前时间戳
tp=arrow.now().timestamp
tp=time.time()
#将2019-02-14 08:00:00转换为时间戳
tp=arrow.get('2019-02-14 08:00:00',tzinfo='local').timestamp
timearray=time.strptime('2019-02-14 08:00:00',"%Y-%m-%d %H:%M:%S")
tp=int(time.mktime(timearray))
#将当前时间转为字符串
str=arrow.now().format() #'2019-02-14 10:45:49+08:00'
str=arrow.now().format('YYYY-MM-DD') #'2019-02-14'
begin=now.shift(months=-3).format(('YYYY-MM-DD'))
t1 = arrow.now().shift(days=-7).format(('YYYY.MM.DD'))
t1time = arrow.get(t1, tzinfo='local').timestamp
时间字符串处理arrow
最新推荐文章于 2023-09-27 09:22:42 发布