Python Get Day Name from Number Example — The strftime() method can also be used to get the name of the day in python.
Example 1:
import calender
dayNumber = 0
dayName = calender.day_name[dayNumber]
print("Day Name: " + str(dayName))
Example 2:
from datetime import date
currentDate = date.today()
longName = currentDate.strftime('%A')
print("Long Day Name: " + longName)
shortName = currentDate.strftime('%a')
print("Short Day Name: " + shortName)
I hope you like this Python Get Day Name from Number Example article.
Also Read :
- How to Check if Today is Friday or not in Python?
- Python GET Request with Parameters
- Python POST Request with Parameters Example
- Top 10 VS Code extensions
- Angular Material Grid Layout Example
- Angular Material Card Example