Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python lastmonth

from datetime import date, timedelta

last_day_of_prev_month = date.today().replace(day=1) - timedelta(days=1)

start_day_of_prev_month = date.today().replace(day=1) - timedelta(days=last_day_of_prev_month.day)

# For printing results
print("First day of prev month:", start_day_of_prev_month)
print("Last day of prev month:", last_day_of_prev_month)
Comment

PREVIOUS NEXT
Code Example
Python :: balancing paranthesis python 
Python :: Get a list of categories of categorical variable (Python Pandas) 
Python :: scree plot sklearn 
Python :: datetime column only extract date pandas 
Python :: turtle 
Python :: python call function in class 
Python :: python cls command line 
Python :: df split into train, validation, test 
Python :: type python 
Python :: python program to find the sum of fibonacci series 
Python :: python temporary file 
Python :: input code for python 
Python :: deep learning with python 
Python :: pandas como quitar comillas simples de una columna 
Python :: how change column strin of list data type to list 
Python :: matplotlib axis labels 
Python :: python milisegundos 
Python :: python if true 
Python :: dda line drawing algorithm 
Python :: handwritten digits data set 
Python :: pandas.get_dummies 
Python :: argparse print help if no arguments 
Python :: dictionary in python 
Python :: how to check if a variable holds a class reference in python 
Python :: pow() Function Function in python 
Python :: slack bot error not_in_channel 
Python :: dataframe print column 
Python :: python os get dir path 
Python :: __dict__ python? 
Python :: openmp for loop 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =