Skip to content
Advertisement

Tag: weekday

How do I get the day of week given a date?

I want to find out the following: given a date (datetime object), what is the corresponding day of the week? For instance, Sunday is the first day, Monday: second day.. and so on And then if the input is something like today’s date. Example The output is maybe 6 (since it’s Friday) Answer Use weekday(): From the documentation: Return the

Advertisement