Reputation: 11
In python 2 can you please tell me how to just print hours, minutes and seconds with UTC
Trying to avoid printing out the date Thanks
import datetime
import pytz
T7 = datetime.datetime.utcnow()
print(T7)
Upvotes: 0
Views: 2993
Reputation: 2685
Have a look at the documentation at https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
The code below will give you what you need.
datetime.datetime.utcnow().strftime("%H:%M:%S")
Upvotes: 1