Skip to content

Commit 8abebb1

Browse files
author
Gautam kumar jaiswal
committed
Add Day_of_week script
This is a script to find a day of the week for a given date.
1 parent 8f6bcf6 commit 8abebb1

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Python/Day_ofWeek/Day_of_week.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Python program to Find day of
2+
# the week for a given date
3+
import calendar #module of python to provide useful fucntions related to calendar
4+
import datetime # module of python to get the date and time
5+
6+
7+
def findDay(date):
8+
born = datetime.datetime.strptime(date, '%d %m %Y').weekday() #this statement returns an integer corresponding to the day of the week
9+
return (calendar.day_name[born]) #this statement returns the corresponding day name to the integer generated in the previous statement
10+
11+
12+
# Driver program
13+
date = input() #this is the input date
14+
print(findDay(date)) # here we print the final output after calling the fucntion findday
15+
16+
#__author__ = Gautam Kumar Jaiswal

Python/Day_ofWeek/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# DAY OF WEEK
2+
3+
This is a python script, that find day of the week for a given date.
4+
5+
### Dependencies
6+
* calender
7+
* datetime
8+
9+
### How to run?
10+
> py Day_of_week.py
11+
12+
### Snapshot
13+
![snapshot](snapshot.PNG)

Python/Day_ofWeek/snapshot.PNG

10.7 KB
Loading

0 commit comments

Comments
 (0)