Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

time.ctime(os.path.getmtime phyton in datetime

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 /
Comment

PREVIOUS NEXT
Code Example
Python :: pandas remove item from dictionary 
Python :: nltk in python 
Python :: Python - Count the Number of Keys in a Python Dictionary 
Python :: python dict dot notation 
Python :: what is cleaned data in django 
Python :: python palindrome string 
Python :: smtp email template 
Python :: how to print hello world in python 
Python :: list of files to zip python 
Python :: slack send message python 
Python :: remove alphabetic characters python 
Python :: pandas merge dataframes by column 
Python :: numpy check if 2 array identical 
Python :: python gzip file 
Python :: pandas series to numpy array 
Python :: python class name 
Python :: return max repeated value in list 
Python :: variable naming rule in python 
Python :: convert pandas column type 
Python :: django add model 
Python :: modulus of python complex number 
Python :: correlation between two columns pandas 
Python :: read a file and split the words python 
Python :: how to 404 custom page not found in django 
Python :: time until 2021 
Python :: python - row slice dataframe by number of rows 
Python :: create 3x3 numpy array 
Python :: python import worldcloud 
Python :: convert string to class name python 
Python :: python optionmenu tkinter 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =