# Convert Time-code into number

Hi everyone i am import csv file into a tab dat, I have time-code data and convert it into a float number to use it in a chop context. Do you have any idea on how to work with this? Maybe with evaluate dat but I don’t know how to use it.

thank you in advance to anyone

Be carreful, thats time but not Timecode!
TC is in the form (here in Europ) 08:30:25:10
You can do it with some python.
something like that (not tested)

``````TC = op('select1')[0,0] // read the cell
TC = TC.split(" ") // split around space
TCsplit = TC[0].split(':') // split first part around :
h = int(TCsplit[0]) // hours
if TC[1] == "PM":
h = h + 12 // add 12h if PM
m = int(TCsplit[1])
s = int(TCsplit[2])
timeSec = 3600 * h + 60 * m + s // total time in seconds
``````
1 Like

Jacques’ solution will be the most efficient (performant) but you can also do the same “splitting” with Convert DATs. You can “convert” tables to tables and change the “Split Cells at” parameter to something other than a tab to split single cells into more:

Just make sure your incoming data is exactly in that format or you might get some weird results depending on how you use it farther down the line. That tip applies to both the python and DAT based examples above.

1 Like

Thankyou very much for the help, since I am not so comfortable with python I followed the peeet suggestion with convert dat.
I ended up selecting each column, multiply for 3600 hours, for 60 the minutes and then summed all three chops together.