Getting Current Year, Month, Day, Time using Python

Python’s built-in module datetime can be used for knowing what is current Year, Month, Day, Time.

Python Code for Getting Current Year

import datetime
current_year =

Python Code for Getting Current Month

import datetime
current_month =

Python Code for Getting Current Day

import datetime
current_day =

Python Code for Getting Current Time

import datetime
current_hour =
current_minute =
current_second =
print(str(current_hour) + ":" + str(current_minute) + ":" + str(current_second))


Hi, there I'm founder of ComputerScienceHub(Started this to bring useful Computer Science information just at one place). Personally I've been doing JavaScript, Python development since 2015(Been long) - Worked upon couple of Web Development Projects, Did some Data Science stuff using Python. Nowadays primarily I work as Freelance JavaScript Developer(Web Developer) and on side-by-side managing team of Computer Science specialists at

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts