Skip to content

Instantly share code, notes, and snippets.

@shubhamagarwal92
Created January 17, 2019 17:57
Show Gist options
  • Save shubhamagarwal92/9baccb9aa6b9268b253a6e6199c897c3 to your computer and use it in GitHub Desktop.
Save shubhamagarwal92/9baccb9aa6b9268b253a6e6199c897c3 to your computer and use it in GitHub Desktop.
Get the english day from a date
# This example shows for the current date. Modify it to get the day for
# any particular date of the format
# date(year, month, day)
from datetime import date
import calendar
def sample_date2day():
my_date = date.today()
# my_date = date(year, month, day)
print(my_date)
print(my_date.weekday()) # Monday is 0 and Sunday is 6
print(calendar.day_name[my_date.weekday()])
sample_date2day()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment