Get Day name from Weekday int

后端 未结 8 1123
梦如初夏
梦如初夏 2020-12-14 05:14

I have a weekday integer (0,1,2...) and I need to get the day name (\'Monday\', \'Tuesday\',...).

Is there a built in Python function or way of doing this?

H

8条回答
  •  萌比男神i
    2020-12-14 05:56

    If you need just to print the day name from datetime object you can use like this:

    current_date = datetime.now
    current_date.strftime('%A')  # will return "Wednesday"
    current_date.strftime('%a')  # will return "Wed"
    

提交回复
热议问题