How can I get the day name (such as Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday) from a datetime object in Python?
So, for example, datetime(2019, 9, 6, 11, 33, 0)
should give me "Friday"
.
How can I get the day name (such as Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday) from a datetime object in Python?
So, for example, datetime(2019, 9, 6, 11, 33, 0)
should give me "Friday"
.
import datetime
now = datetime.datetime.now()
print(now.strftime("%A"))
See the Python docs for datetime.now, datetime.strftime and more on strftime.