python时间转换的方法
来源:互联网 发布:乔丹最后一个赛季数据 编辑:程序博客网 时间:2024/06/05 21:14
目前有一个精确到毫秒的long类型的时间戳, 如1451177600000, 这里我们想作以下操作:
- 转换为正常的时间格式
- 获取时间的星期
这里主要涉及到两个模块: time
、datetime
, 具体代码如下:
import timea = time.ctime(1451177600000/1000)print a#out[1]: 'Sun Dec 27 08:53:20 2015'print 'Day: %s' % a[:3] #out[2]: Day: Sun
from datetime import datetimedatetime.fromtimestamp(1451177600000/1000).strftime('%Y-%m-%d %H:%M:%S')#Out[33]: '2015-12-27 08:53:20'
阅读全文
0 0
- python时间转换的方法
- Python的时间转换
- python的时间戳转换
- Python的UTC时间转换
- Python时间格式的转换
- python时间戳于时间格式字符串相互转换的方法
- python转换时间戳和日期时间格式的转换
- python常用的时间方法
- python常用的时间方法
- python常用的时间方法
- python进行时间和秒的转换
- python时间与字符串之间的转换
- Python 时间与秒数的转换
- python之常用的时间格式转换
- Python- 时间格式的相互转换
- python-时间戳转换时间
- python时间和时间戳之间的转换
- python中时间、日期、时间戳之间的转换
- 这可能是2017最经典的Android面试题
- 如何解决MathType兼容Office 2016
- Ubuntu下OpenCV编程[1]-下载并安装测试OpenCV库
- 洛谷P3381【模板】最小费用最大流
- 基于JPA获取查询中的单条记录
- python时间转换的方法
- expect备份交换机配置
- Appium+python+android连接
- 反向代理到google
- Android MP3录制
- Python 单线程死锁(自己等自己),Rlock解决
- 使用loadrunner做webservices接口的性能测试
- Linux下安装配置ftp
- 备忘录模式