Answers for "get deltatime python"

12

get date and time python

from datetime import datetime
now = datetime.now()
print (now.strftime("%Y-%m-%d %H:%M:%S"))


Output: 2020-06-19 10:34:45
Posted by: Guest on June-19-2020
6

get time pithon

"""Imports the datetime package from the Python library"""
from datetime import datetime

"""Sets the variable now to the current date and time"""
now = datetime.now()

"""The variable current_time contains the string values of the current time"""
current_time = now.strftime("%H:%M:%S")
print("Current Time =", current_time)
Posted by: Guest on May-29-2020
7

print time python

from datetime import datetime

now = datetime.now().time() # time object

print("now =", now)
print("type(now) =", type(now))
Posted by: Guest on March-22-2020
3

how to print time python

import datetime
datetime.datetime.now()
datetime.datetime(2009, 1, 6, 15, 8, 24, 78915)

print(datetime.datetime.now())
#2009-01-06 15:08:24.789150
Posted by: Guest on June-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language