Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python first day of last month

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

first day of the month python

from datetime import datetime

datetime.today().replace(day=1)
Comment

PREVIOUS NEXT
Code Example
Python :: python list comma separated string 
Python :: python auto updating clock 
Python :: delete index in elasticsearch python 
Python :: pandas to pickle 
Python :: how to print all combinations of a string in python 
Python :: How to perform insertion sort, in Python? 
Python :: pandas load dataframe without header 
Python :: how to find second maximum element of an array python 
Python :: Dummy or One Hot Encoding code with pandas 
Python :: Installing python module from within code 
Python :: python thread with parameters 
Python :: list to tuple 
Python :: check date on template django 
Python :: classes in python with self parameter 
Python :: remove all zeros from list python 
Python :: binomial coefficient python 
Python :: how to remove numbers from string in python dataframe 
Python :: convert number to binary in python 
Python :: pickle.load python 
Python :: how to launch an application using python 
Python :: print type(x) in python 
Python :: get cuda memory pytorch 
Python :: remove outliers numpy array 
Python :: pyplot bar plot colur each bar custom 
Python :: use of == python 
Python :: how to hide command console python 
Python :: column contains substring python 
Python :: python read string from file 
Python :: filter dataframe 
Python :: base64 python decode 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =