Python Program To Get Current Time





Hi Guys,

In this blog, I will show how to get get current time in python. We will talk about get current time using python program. In this article, we will know how to get the current time in Python.

This article will give you example of get current time using pytz module in python. I am going to learn you python get current time example.

Here i will give you three example of how to get current time in python. So let's see bellow example:

Example 1

from datetime import *

import pytz

tz = pytz.timezone('Asia/Kolkata')

datetime =

print("INDIA time:", datetime.strftime("%H:%M:%S"))


INDIA time: 04:58:06

Example 2

from datetime import datetime

# now() method is used to

# current date & time object.

nowDateTime =

# strftime() method used to

# get current time.

currentTime = nowDateTime.strftime("%H:%M:%S")

print("Current Time =", currentTime)


Current Time = 04:58:06

Example 3

from datetime import datetime

# Time object containing

time =

print("Current Time is ", time)


Current Time is 04:58:06

It will help you....

Recommended Posts