Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将滴答时间转换为Python hh:mm:ss_Python_Excel - Fatal编程技术网

将滴答时间转换为Python hh:mm:ss

将滴答时间转换为Python hh:mm:ss,python,excel,Python,Excel,我使用Python从Excel中获取时间值,但它是浮点格式,因此我将介绍如何将Excel中的时间值转换为标准时间字符串HH:MM:SS。在Excel中,时间应为17:30:01,时间在内部表示为浮点,1.0表示1天。零点是1899-12-31T00:00:00 from datetime import datetime, timedelta dt = datetime(1899,12,31, 0, 0, 0) + timedelta(days=excel_value) print(dt.strf

我使用Python从Excel中获取时间值,但它是浮点格式,因此我将介绍如何将Excel中的时间值转换为标准时间字符串HH:MM:SS。在Excel中,时间应为17:30:01

,时间在内部表示为浮点,1.0表示1天。零点是
1899-12-31T00:00:00

from datetime import datetime, timedelta
dt = datetime(1899,12,31, 0, 0, 0) + timedelta(days=excel_value)
print(dt.strftime('%H:%M:%S'))

在Excel中,时间在内部表示为float,1.0表示1天。零点是
1899-12-31T00:00:00

from datetime import datetime, timedelta
dt = datetime(1899,12,31, 0, 0, 0) + timedelta(days=excel_value)
print(dt.strftime('%H:%M:%S'))

Excel文件中的时间表示单位是什么?Excel文件中的时间表示单位是什么?是的,就是它!谢谢你是的就是这样!非常感谢。