Use weekday()
:
>>> import datetime
>>> datetime.datetime.today()
datetime.datetime(2012, 3, 23, 23, 24, 55, 173504)
>>> datetime.datetime.today().weekday()
4
From the documentation:
Return the day of the week as an integer, where Monday is 0 and Sunday is 6.
More Related Contents:
- In Python, how do you convert seconds since epoch to a `datetime` object?
- Splitting timestamp column into separate date and time columns
- How do I get the current time?
- How to print a date in a regular format?
- Iterating through a range of dates in Python
- Creating a range of dates in Python
- Adding days to a date in Python
- How can I parse a time string containing milliseconds in it with python?
- Get current time in milliseconds in Python?
- Find the end of the month of a Pandas DataFrame Series
- How to format date string via multiple formats in python
- Check if string has date, any format
- How do I get the current time in milliseconds in Python?
- Generate a list of datetimes between an interval
- Extract day of year and Julian day from a string date
- Python speed testing – Time Difference – milliseconds
- How do I change the file creation date of a Windows file?
- Convert numpy.datetime64 to string object in python
- Comparing two date strings in Python
- Difference between Python datetime vs time modules
- In python, how to check if a date is valid?
- Convert date to datetime in Python
- How to add/subtract time (hours, minutes, etc.) from a Pandas DataFrame.Index whos objects are of type datetime.time?
- Which is the fastest way to extract day, month and year from a given date?
- Python: Figure out local timezone
- How to convert epoch time with nanoseconds to human-readable?
- Formatting “yesterday’s” date in python
- How to combine year, month, and day columns to single datetime column?
- How do I convert timestamp to datetime.date in pandas dataframe?
- Convert dates to pd.to_datetime where month could be either a number or month name