Created
June 30, 2016 11:44
-
-
Save azhar22k/26d0d7c666c7b29145b1f13c21197602 to your computer and use it in GitHub Desktop.
Program to read birthdate and display birthday month and calculate days till next birthday
This file contains hidden or 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
#Read birthdate and display birthday manth | |
import datetime | |
birthday=input("What is your birthday date['yyyy-mm-dd' format] ") | |
birthday=datetime.datetime.strptime(birthday,"%Y-%m-%d").date() | |
print("Birthday month is "+birthday.strftime('%B')) |
This file contains hidden or 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
#read next birthday and display number of days left till next birthday | |
import datetime | |
birthday=input("When is your next birthday ['yyyy-mm-dd' format] : ") | |
birthday=datetime.datetime.strptime(birthday,"%Y-%m-%d").date() | |
CurrentDay=datetime.date.today() | |
diff=birthday-CurrentDay | |
print("There are {0:} day(s) left till your next Birthday".format(diff.days)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment