Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tkcpm951
Contributor
Contributor

convert text 03h 46mn 55s to hh:mm:ss

Hello
I have a csv file with time data in text format
here are 2 examples:
data: "03h 46mn 46mn 55s"
that I would like to convert in the script to "3:46:55" format

data: "32mn 20s"
that I would like to convert in the script to the format "0:32:20"
Can someone help me?
Thank you in advance
Piere

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

try like this:

=if(wildmatch(Replace(YourTimeField,' ',':'),'*h*')=1,Time(keepchar(Replace(YourTimeField,' ',':'),'0123456789:'),'h:mm:ss'),'0:'&keepchar(Replace(YourTimeField,' ',':'),'0123456789:'))

View solution in original post

4 Replies
Marcos_rv
Creator II
Creator II

try this:

 

maketime( 

if( isnull(SubField(data, 'h', 1)), 00, SubField(data, 'h', 1) ) , //hours

if( isnull(SubField(data, 'm', 1)), 00, right(SubField(data, 'm', 1), 2 ) ) ,//mins

if( isnull(SubField(data, 's', 1)), 00, right(SubField(data, 's', 1), 2 ) )

)

 

saludos!!!

Frank_Hartmann
Master II
Master II

try like this:

=if(wildmatch(Replace(YourTimeField,' ',':'),'*h*')=1,Time(keepchar(Replace(YourTimeField,' ',':'),'0123456789:'),'h:mm:ss'),'0:'&keepchar(Replace(YourTimeField,' ',':'),'0123456789:'))
tkcpm951
Contributor
Contributor
Author

Thank you very much, Frank, that's exactly what it is!

tkcpm951
Contributor
Contributor
Author

Thanks Marcos, it works for data 3h 45mn 12s but when there is no time (ex 22mn 12s) it brings me back an empty value