2001-10-18 I want to calculate weekday e.g. Monday, Tuesday from the date given above. is it possible in python?
Here is one way to do this:
dt = '2001-10-18'
year, month, day = (int(x) for x in dt.split('-'))
answer = datetime.date(year, month, day).weekday()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With