How to change a column to time if its in a strange formatHello Everyone,
I have a column that has time in it and its formatted like this 01h17m03s I would like to make this continuous data and everything I try to do doesn't work. Could I use a script to change this?
Any ideas would tremendously help out.
Thanks,
-Ryan
Data TableScriptingRe: How to change a column to time if its in a strange formatYou could use a formula where :txt is your column with time:
InHours(Num(Word(1, :Txt, "hms"))) + InMinutes(Num(Word(2, :Txt, "hms"))) + Num(Word(3, :Txt, "hms"))
And then change the column to Numeric continuous and format as Time h:m:s (might differ depending on your time format)

Re: How to change a column to time if its in a strange formatNames Default to Here( 1 );
// make data like 01h17m03s
dt = New Table( "Time",
Add Rows( 10 ),
New Column( "Original", Character, Ordinal ),
New Column( "Converted", Numeric, Continuous, Format( "H:M:S" ) )
);
// utility
padded = Function( { l, h }, { v },
v = Random Integer( l, h );
v = If( v < 10, "0", "" ) || Char( v );
);
// populate original value
For Each Row(
h = padded( 0, 24 );
m = padded( 0, 60 );
s = padded( 0, 60 );
:Original = Concat( h, "h", m, "m", s, "s" );
);
// now convert it to JMP time number
For Each Row(
:Converted = Eval(
Parse(
Regex( :Original,
"(\d\d)h(\d\d)m(\d\d)s",
"\3 + 60*(\2) + 3600*(\1)"
)
)
)
);