python 爬虫中时间和时间戳的互相转换
2017-02-16 17:57
344 查看
时间戳到时间的转换:
publicTime =time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
publicTimestamp = time.mktime(time.strptime(publicTime, "%Y-%m-%d %H:%M:%S"))
时间到时间戳的转换:
time_local = time.localtime(comment_timestamp)
comment_time= time.strftime("%Y-%m-%d %H:%M:%S", time_local)
publicTime =time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
publicTimestamp = time.mktime(time.strptime(publicTime, "%Y-%m-%d %H:%M:%S"))
时间到时间戳的转换:
time_local = time.localtime(comment_timestamp)
comment_time= time.strftime("%Y-%m-%d %H:%M:%S", time_local)
相关文章推荐
- 【Python爬虫实战--2】时间戳转换为指定格式日期
- Python时间和时间戳互相转换
- Shell Python 日期和时间戳的互相转换
- python时间时分秒与秒数的互相转换
- P006_Python时间戳与时间字符串互相转换
- Python时间戳与时间字符串互相转换实例代码
- python时间时分秒与秒数的互相转换
- Python时间戳与时间字符串互相转换
- Python时间戳与时间字符串互相转换实例代码
- Python时间戳与时间字符串互相转换实例代码
- Python时间戳与时间字符串互相转换实例代码
- 日期和unix时间戳的互相转换
- python时间和时间戳之间的转换
- Python中时间戳与时间字符串互相转化
- python3中bytes与string的互相转换
- python日期时间字符串转换成unix时间戳
- Python 进制互相转换(二进制、十进制和十六进制)
- Python中时间戳与时间字符串互相转化
- python 字符串和时间转换
- Python中时间戳与时间字符串互相转化