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.
Example 1:
main.py
import calendar dayNumber = 0 dayName = calendar.day_name[dayNumber] print("Day Name : " + str(dayName))
Output:
Day Name : Monday
Example 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 : Wednesday Short Day Name : Wed
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
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?