Python Get Day Name from Number Example
In this post, we will learn python get day name from number. I would like to share with you python get day name from date. I would like to show you python calendar get day name. I explained simply step by step python number to day name.
In this example, 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.
import calendar dayNumber = 0 dayName = calendar.day_name[dayNumber] print("Day Name : " + str(dayName))
Day Name : Monday
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)
Long Day Name : Wednesday Short Day Name : Wed
I hope it can help you...
We are Recommending you
- How to Get Yesterday Date in Python?
- How to Get Tomorrow Date in Python?
- How to Get Current Second in Python?
- How to Get Current Minute in Python?
- How to Get Current Month in Python?
- How to Get Current Day in Python?
- How to Get Current Year in Python?
- How to Get Current Date and Time in Python?
- How to Get Current Date in Python?