<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to change a column to time if its in a strange format in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430508#M68022</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names 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 &amp;lt; 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)"
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 26 Oct 2021 16:01:40 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2021-10-26T16:01:40Z</dc:date>
    <item>
      <title>How to change a column to time if its in a strange format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430369#M68008</link>
      <description>&lt;P&gt;Hello Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas would tremendously help out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Ryan&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:39:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430369#M68008</guid>
      <dc:creator>rmthomas</dc:creator>
      <dc:date>2023-06-10T23:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to change a column to time if its in a strange format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430419#M68011</link>
      <description>&lt;P&gt;You could use a formula where :txt is your column with time:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;InHours(Num(Word(1, :Txt, "hms"))) + InMinutes(Num(Word(2, :Txt, "hms"))) + Num(Word(3, :Txt, "hms"))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And then change the column to Numeric continuous and format as Time h:m:s (might differ depending on your time format)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1635255888290.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37007i29B84030808C2B49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1635255888290.png" alt="jthi_1-1635255888290.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 13:45:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430419#M68011</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-10-26T13:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to change a column to time if its in a strange format</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430508#M68022</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names 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 &amp;lt; 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)"
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Oct 2021 16:01:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-change-a-column-to-time-if-its-in-a-strange-format/m-p/430508#M68022</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2021-10-26T16:01:40Z</dc:date>
    </item>
  </channel>
</rss>

