Answers for "how to take data and time in python"

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
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

Code answers related to "how to take data and time in python"

Python Answers by Framework

Browse Popular Code Answers by Language