Skip to main content


Python Program - When was I born? / Date of Birth / MY BIRTHDAY (using Python3+)


This simple program that I have created will tell you the exact date of BIRTH visually without any complex coding.

The code are as follows:-

import time, calendar
#Enter date in this format -> 19990606
# i.e. Year-month-day
#That is 1999 - Year, 06 - month, 06 - day
dt = input('')
a = (dt[0:4])
b = (dt[4:6])
c = (dt[6:8])
print ('Your Date of Birth is:')
print (c + '-' + b + '-' + a)
x = str(a) + "-" + str(b) + "-" + str(c)
y = time.strftime("%A", time.strptime(x,"%Y-%m-%d"))
print ('The Day was ' + y)
d = calendar.TextCalendar(calendar.SUNDAY)
d.prmonth(int(a), int(b))

First for your kind info we are using python3+ not python2.7

We will now import time and calendar.

We are going to give it input function so after running the code it will ask for our input.

And the input will be in following format i.e.

(YOUR FULL DATE OF BIRTH)
    Year - Month - Day
Eg. 1999 - 06 - 06

We will not use dash ( - ) so we will only type in 19990606

We will make Sunday as the starting week therefore we use callendar.SUNDAY

And we get the output as...

Your Date of Birth is:
06-06-1999
The Day was Sunday
     June 1999
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Hope you like the tutorial.

Try this code 🔴LIVE here
👉 https://code.sololearn.com/c9EyW4pQmCcl

Python is simple and fun to play with and yet very powerful. 🔥


🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍🐍

Popular Posts

Python underline string, Python underline text, Underline python print

Python pip - Installing modules from IDLE (Pyton GUI) for python 3.7

Top 40 Python - String Processing in Python | Working with String in Python

Top 11 Essential Python Tips and Tricks





Subscribe to our Channel


Follow us on Facebook Page

Join our python facebook groups



Join us on Telegram