首页 > 编程语言 > 详细

python 时间戳转化

时间:2016-04-28 12:29:21      阅读:301      评论:0      收藏:0      [点我收藏+]
def change_time(times,status):
   if status==1:
       time_stamp_arrary=time.localtime(times)
       date_time=time.strftime("%Y-%m-%d",time_stamp_arrary)
       return date_time
   elif status==0:
       time_array=time.strptime(times,"%Y-%m-%d")
       time_stamp=int(time.mktime(time_array))
       return time_stamp


本文出自 “新掌门” 博客,请务必保留此出处http://linuxnewstar.blog.51cto.com/6967359/1768491

python 时间戳转化

原文:http://linuxnewstar.blog.51cto.com/6967359/1768491

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!