Python ProgrammingPython Programming

Python get start and end date of current week

Use Pendulum module to solve Date time problems.
Install it using below command

pip install pendulum
import pendulum

today = pendulum.now()

start = today.start_of('week')
print(start.to_datetime_string())

end = today.end_of('week')
print(end.to_datetime_string())
Output
2021-05-10 00:00:00
2021-05-16 23:59:59