How to Get Day Name from Number in Python?
Published On: 03/09/2022 | Category:
Python

Hi Guys,
In this tutorial, I will show you get day name from number python. I would like to show you python get day name from date. you will learn python calendar get day name. I would like to show you python number to day name. Alright, let’s dive into the steps.
Here, I will give two examples for you of how to get the day name from number in python. therefore, let's see below example code and try it.
So let's see bellow example:
Example 1: main.pyimport calendar dayNumber = 5 dayName = calendar.day_name[dayNumber] print("Day Name : " + str(dayName))Output:
Day Name : SaturdayExample 2: main.py
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)Output:
Long Day Name : Saturday Short Day Name : Sat
It will help you....