Solution1:Use datetime module
datetime
import datetime # Print date and time print(datetime.datetime.now()) # only time print(datetime.datetime.now().time())
Solution2:using time.strftime()
time.strftime()
from time import gmtime, strftime print(strftime("%Y-%m-%d %H:%M:%S", gmtime()))
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Solution1:Use
datetime
moduleSolution2:using
need an explanation for this answer? contact us directly to get an explanation for this answertime.strftime()