Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

the month before python dateime

 import datetime
 today = datetime.date.today()
 first = today.replace(day=1)
 lastMonth = first - datetime.timedelta(days=1)
 print(lastMonth.strftime("%Y%m"))
Comment

PREVIOUS NEXT
Code Example
Python :: Concatenate strings using Pandas groupby 
Python :: Finding the Variance and Standard Deviation of a list of numbers in Python 
Python :: pandas dataframe macd 
Python :: python timedelta 
Python :: extract link from text python 
Python :: random py 
Python :: sort array python by column 
Python :: parquet pyspark 
Python :: sns legend outside 
Python :: add time delta pytohn 
Python :: remove duplicate rows in csv file python 
Python :: all combination of params 
Python :: how to roll longitude coordinate 
Python :: get request header flask 
Python :: delete rows in dataframe pandas 
Python :: message tags in django 
Python :: python read lines from text file 
Python :: find nth root of m using python 
Python :: how to remove duplicate files from folder with python 
Python :: python range backward 
Python :: does break stop all loops 
Python :: minimize window with python 
Python :: selenium webdriver python 
Python :: python df round values 
Python :: libreoffice add row at the end of table 
Python :: python get angle between two points 
Python :: check python version conda env 
Python :: download youtube-dl python 
Python :: python exec return value 
Python :: selenium webdriver 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =