1 timeStamp = 1381419600 2 dateArray = datetime.datetime.utcfromtimestamp(timeStamp) 3 otherStyleTime = dateArray.strftime("%Y--%m--%d %H:%M:%S") 4print otherStyleTime # 2013--10--10 15:40:005 dateArray = datetime.datetime.utcfromtimestamp(timeStamp) 6 otherStyleTime = dateArray.strftime("%Y-%m-%d %H:%M:%S") 原文:https://www.cnblogs.com/duanlinxiao/p/9830236.html
1 timeStamp = 1381419600 2 dateArray = datetime.datetime.utcfromtimestamp(timeStamp) 3 otherStyleTime = dateArray.strftime("%Y--%m--%d %H:%M:%S") 4 print otherStyleTime # 2013--10--10 15:40:00 5 dateArray = datetime.datetime.utcfromtimestamp(timeStamp) 6 otherStyleTime = dateArray.strftime("%Y-%m-%d %H:%M:%S")