Python Get Day Name from Number Example

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 :