📜  time.ctime(os.path.getmtime phyton in datetime - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:06.902000             🧑  作者: Mango

代码示例1
x = time.strftime("%d.%m.%Y", time.gmtime(os.path.getmtime("{}".format("file.txt"))))

# getctime can be used instead of getmtime
# getctime = file creation date
# getmtime = last modified file date

#"file.txt" can also be a filepath if it is in a different directory

# time.strftime("%d.%m.%Y")
# changes the output date from time.gmtime(...) in a more readable form.
# %d = day , %m = month, %y = year 
# . in in my case the seperator but it can be anything, like /