Python date isoweekday() Method with Example

Python date.isoweekday() Method: Here, we are going to learn about the isoweekday() method of date class in Python with its definition, syntax, and examples.
Submitted by Hritika Rajput, on April 29, 2020

Python date.isoweekday() Method

date.isoweekday() method is used to manipulate objects of date class of module datetime.

It uses a date class object and returns the day of the week as an integer, where Monday is 1 and Sunday is 7. It is the same as the date.weekday() function where we consider Monday is 0 incrementing by one for the coming days. It is an instance method as it works on an instance of the date class.


    import datetime


    from datetime import date




  • None

Return value:

The return type of this method is a number which tells us what is the day of the week on that day.


## importing date class
from datetime import date

## Since we know the number, we can save them in a list and print the day on that number
day =["0","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

## Creating an instance
x =
d = x.isoweekday()
print("Today's isoweekday number is:", d)
print("Today's day is:",day[d])

x = date(2020, 1, 1)
print("Day on", x.year,"new year was:", day[x.isoweekday()])

x = date(2021, 1, 1)
print("Day on", x.year,"new year will be:", day[x.isoweekday()])


Today's isoweekday number is: 3
Today's day is: Wednesday
Day on 2020 new year was: Wednesday
Day on 2021 new year will be: Friday


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.