Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python set day of date to 1

from datetime import datetime

your_date = datetime.strptime('26 June 2021', '%d %b %Y')
# Using the .replace() method:
newdatetime = your_date.replace(day=1)
# 2021-06-01 00:00:00
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #set #day #date
ADD COMMENT
Topic
Name
4+6 =