Answers for "convert datetime to hours python"

3

how to get the current date hour minute month year in python

########################################################################
import datetime
now = datetime.datetime.now()
print(now.year, now.month, now.day, now.hour, now.minute, now.second)
########################################################################
from datetime import *
now = datetime.now()
print(now.year, now.month, now.day, now.hour, now.minute, now.second)
########################################################################
Posted by: Guest on September-03-2020
0

datatime add time in float

>>> import datetime
>>> d = datetime.datetime(2016, 11, 17)
>>> delta = datetime.timedelta(hours=4.1326742)
>>> d + delta
datetime.datetime(2016, 11, 17, 4, 7, 57, 627120)
Posted by: Guest on March-06-2020

Code answers related to "convert datetime to hours python"

Python Answers by Framework

Browse Popular Code Answers by Language