demo-app / clock.py
theitguy's picture
Create clock.py
554d9d9 verified
import datetime
import pytz
def display_ist_time():
# Set the time zone to IST
ist = pytz.timezone('Asia/Kolkata')
# Get the current time in IST
current_time = datetime.datetime.now(ist)
# Format the time as HH:MM:SS
formatted_time = current_time.strftime("%H:%M:%S")
# Print the current time in IST
print(f"Current Time in IST: {formatted_time}")
# Run the function to display the current time in IST
display_ist_time()