Home > Mobile >  what is this time format: XX:XX.X, and how to transfer it to usual year-month-day-hour-minute-second
what is this time format: XX:XX.X, and how to transfer it to usual year-month-day-hour-minute-second

Time:01-24

I have some date data like:

46:53.4
57:00.0
51:50.9
53:13.9

What is this time format? And how to transfer it to the usual year-month-day-hour-minute-second in Python?

CodePudding user response:

Code:

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)

Result:

1900-01-01 00:46:53.400000

CodePudding user response:

I suppose 46:53.4 means forty-six minutes and fifty-three-point-four seconds.

  •  Tags:  
  • Related