![](/img/trans.png)
[英]How to find a date and time nearest another date and time given in month/day/year hour/minute/second AM format
[英]what is this time format: XX:XX.X, and how to transfer it to usual year-month-day-hour-minute-second in Python
我有一些日期数据,例如:
46:53.4
57:00.0
51:50.9
53:13.9
这个时间格式是什么? 以及如何将其转换为 Python 中通常的年月日时分秒?
代码:
import datetime
#Input Date String
t = "46:53.4"
#Return a datetime corresponding to date string
dateTimeObject = datetime.datetime.strptime(t, '%M:%S.%f')
print (dateTimeObject)
结果:
1900-01-01 00:46:53.400000
我想46:53.4
意味着四十六分五十三点四秒。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.