时间戳处理

# timeStamp = 1381419600
# timeArray = time.localtime(timeStamp)
# otherStyleTime = time.strftime("%Y--%m--%d %H:%M:%S", timeArray)
# print otherStyleTime # 2013--10--10 23:40:00
# # 使用datetime
# timeStamp = 1381419600
# dateArray = datetime.datetime.utcfromtimestamp(timeStamp)
# otherStyleTime = dateArray.strftime("%Y--%m--%d %H:%M:%S")
# print otherStyleTime # 2013--10--10 15:40:00

猜你喜欢

转载自www.cnblogs.com/xdlzs/p/10729954.html