Join WhatsApp ChannelJoin Now

Get Current Time In Hours Minutes Seconds In Python

Hi Dev,

Today, i we will show you get current time in hours minutes seconds in python. This article will give you simple example of get current time in hours minutes seconds in python. you will get current time in hours minutes seconds in python. So let’s follow few step to create example of get current time in hours minutes seconds in python.

Example 1

import time

// get current time in hour, minute, seconds
currentTime = time.strftime("%H:%M:%S")
print(currentTime)

Output:

16:06:41

Example 2

# from datetime import datetime

// get current date and time
currentTimeDate = datetime.now()

// get only time
currentTime = currentTimeDate.strftime('%H:%M:%S')
print(currentTime)

Output:

16:06:41

I hope it will assist you…

Recommended Posts