In this article, we are going to learn how we can get the day of the week in Python. We will make use of the datetime module of Python to get the current date. Once we have the current date then we will extract the week day from it.
Environment & Requirements :
Program to get day of week
from datetime import datetime print(datetime.today().weekday())
Program code explanation
1.Weekday()can be used to retrieve the day of the week.
2.The datetime.today() returns the current date
3.The weekday() method returns the day of the week as an integer where Monday is indexed as 0 and Sunday is 6.