Get the App
SLTechnology News&Howtos  ›  Servers  › 

Unix timestamp converted to normal YYYY-MM-DD HH-MM-S

Shulou Source: shulou.com Published: 2022-06-03 10:19:38 12月06日 Update

Def stringToUnix (string):

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

Return str (unixTime)

Def newUnixTime (time_input, oldtimeList):

NewUnixTimeList = []

For oldtime in oldtimeList:

Olddatetime = datetime.fromtimestamp (int (oldtime))

DayAndhms = str (olddatetime) .split ("")

Newtime = time_input +''+ dayAndhms [1]

New_Time = stringToUnix (newtime)

NewUnixTimeList.append (new_Time)

Return newUnixTimeList

Tags: time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information Shulou Tech Info Linux vpn