Skip to content

Instantly share code, notes, and snippets.

@azhar22k
Created June 30, 2016 11:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azhar22k/26d0d7c666c7b29145b1f13c21197602 to your computer and use it in GitHub Desktop.
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
#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'))
#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