Created
January 17, 2019 17:57
-
-
Save shubhamagarwal92/9baccb9aa6b9268b253a6e6199c897c3 to your computer and use it in GitHub Desktop.
Get the english day from a date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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