Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change a decimal to time in datetime python

str(int(math.floor(time))) + ':' + str(int((time%(math.floor(time)))*60)) + ':' + str(int(((time%(math.floor(time)))*60) % math.floor(((time%(math.floor(time)))*60))*60))
Comment

change a decimal to time in datetime python

time = 72.345

hours = int(time)
minutes = (time*60) % 60
seconds = (time*3600) % 60

print("%d:%02d.%02d" % (hours, minutes, seconds))
>> 72:20:42
Comment

PREVIOUS NEXT
Code Example
Python :: how to find highest number in list python 
Python :: python create unreadable save file 
Python :: parse xml in python 
Python :: django admin.py date format 
Python :: bash escape double quote windows batch 
Python :: how to address null in python 
Python :: shift in python 
Python :: python dataframe show row 
Python :: scikit learn random forest 
Python :: merge pdf 
Python :: python for in range 
Python :: Broadcasting with NumPy Arrays Two dimension array dimension array Example 
Python :: convert list to dataset python 
Python :: json payload python function 
Python :: numpy roll 
Python :: python ON DUPLICATE KEY UPDATE 
Python :: How to Get the length of all items in a list of lists in Python 
Python :: can list hold different data types in python 
Python :: for loop only for first 10 python 
Python :: python read hex file 
Python :: django annotate 
Python :: normalize a group in countplot 
Python :: python autoclick website 
Python :: python how to exit function 
Python :: feature engineering data preprocessing 
Python :: .translate python 
Python :: assign exec function to variable python 
Python :: fix the size of a deque python 
Python :: pandas join dataframe 
Python :: python table code 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =