unix時間戳轉換成正常YYYY-MM-DD HH-MM-SS時間


def stringToUnix(string):python

    unixTime = time.mktime(time.strptime(string,"%Y-%m-%d %H:%M:%S"))app

    return str(unixTime)ide


def newUnixTime(time_input, oldtimeList):unix

    newUnixTimeList = []input

    for oldtime in oldtimeList:  string

        olddatetime = datetime.fromtimestamp(int(oldtime))it

        dayAndhms = str(olddatetime).split(" ")class

        newtime = time_input + ' ' + dayAndhms[1]date

        new_Time = stringToUnix(newtime)List

        newUnixTimeList.append(new_Time)

    return newUnixTimeList

相關文章
相關標籤/搜索