<?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 fix a duration with missing colon : in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/945056#M109640</link>
    <description>&lt;P&gt;Formula for the quick formula method when the columns are character columns. This makes assumption that values which are already duration "formatted" will have zero padding for hour (such as&amp;nbsp;&lt;STRONG&gt;0&lt;/STRONG&gt;9:00:00)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;numonly = Substitute(_relative_from_X__1, ":", ""); // remove ":"
hrm = Left(numonly, 4); // take 4 characters from left
val = Num(hrm); // convert to numeric for calculations
h = Floor(val / 100); // take only hundreds
m = Mod(val, 100); // remainder
t = h * 60*60 + m * 60; // convert to seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1777467028211.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101460i4400AB2E6EEE7939/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1777467028211.png" alt="jthi_1-1777467028211.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I create new columns here so I can easily compare them to the starting point. After creating formulas, do required type changes using standardize attributes (data type, modeling type, format)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1777467219709.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101461i5FDF08F5953F9084/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1777467219709.png" alt="jthi_2-1777467219709.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;This will create new data columns, you might want to use in place data instead&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Transform column
Data Table("example for JMP com v2") &amp;lt;&amp;lt; Apply Formula(
	Columns(Group(:X__1, 12), Ref("_relative_from_X__1")),
	Formula(
		numonly = Substitute(_relative_from_X__1, ":", "");
		hrm = Left(numonly, 4);
		val = Num(hrm);
		h = Floor(val / 100);
		m = Mod(val, 100);
		t = h * 60 * 60 + m * 60;
	),
	Output(New Static)
) &amp;lt;&amp;lt; Run Formulas;


// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com v2"));
	For Each({col, index},
		{:X__1 2, :X__2 2, :X__3 2, :X__4 2, :X__5 2, :X__6 2, :X__7 2, :X__8 2,
		:X__9 2, :X__10 2, :X__11 2, :X__12 2},
		col &amp;lt;&amp;lt; Set Data Type(Numeric, Format("Best", 12))
	);
	Current Data Table(old dt);
);

// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com v2"));
	For Each({col, index},
		{:X__1 2, :X__2 2, :X__3 2, :X__4 2, :X__5 2, :X__6 2, :X__7 2, :X__8 2,
		:X__9 2, :X__10 2, :X__11 2, :X__12 2},
		col &amp;lt;&amp;lt; Set Modeling Type("Continuous")
	);
	Current Data Table(old dt);
);

// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com v2"));
	For Each({col, index},
		{:X__1 2, :X__2 2, :X__3 2, :X__4 2, :X__5 2, :X__6 2, :X__7 2, :X__8 2,
		:X__9 2, :X__10 2, :X__11 2, :X__12 2},
		col &amp;lt;&amp;lt; Format("hr:m", 12)
	);
	Current Data Table(old dt);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2026 13:00:23 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2026-04-29T13:00:23Z</dc:date>
    <item>
      <title>How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944919#M109633</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an issue that I haven't encountered before...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an Excel file with 87 columns of durations that should be in hh:mm&lt;/P&gt;
&lt;P&gt;However, they are in hhmm or hmm &amp;lt;-- note the missing &lt;STRONG&gt;:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If the duration is less than 10:00 it is three figures&amp;nbsp; (9:59 is entered as 959)&lt;/LI&gt;
&lt;LI&gt;If the duration is more than 9:59 it is four figures (11:52 is entered as 1152)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I can handle this if it were 1 or 2 columns, but not 87.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See attached file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All help is highly appreciated!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers, Christian&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2026 19:28:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944919#M109633</guid>
      <dc:creator>Stats_Like_Jazz</dc:creator>
      <dc:date>2026-04-28T19:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944930#M109634</link>
      <description>&lt;P&gt;Plenty of options (I think all off these should work)&lt;/P&gt;
&lt;P&gt;1. Convert them all to strings&lt;/P&gt;
&lt;P&gt;2. Add 0 to the start&lt;/P&gt;
&lt;P&gt;3. Take last 4 characters&lt;/P&gt;
&lt;P&gt;4. Insert ":" as third character&lt;/P&gt;
&lt;P&gt;5. Convert them to numeric with duration formatting&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

cols = dt &amp;lt;&amp;lt; Get Column Names("String");

For Each({colname}, cols,
	Column(dt, colname) &amp;lt;&amp;lt; Set Data Type("Character");
	Eval(EvalExpr(
		dt &amp;lt;&amp;lt; Apply Formula(
		Columns(Expr(NameExpr(AsColumn(dt, colname)))),
			Formula(
				s = Right("0" || Expr(NameExpr(AsColumn(dt, colname))), 4);
				Left(s, 2) ||":"||Right(s,2)
			),
			Output("In Place")
		) &amp;lt;&amp;lt; Run Formulas;
	));
);

For Each({colname}, cols,
	Column(dt, colname) &amp;lt;&amp;lt; Set Data Type(Numeric, Format("hr:m", 30), Input Format("hr:m")) &amp;lt;&amp;lt; Set Modeling Type("Continuous");
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

cols = dt &amp;lt;&amp;lt; Get Column Names("String");

dt &amp;lt;&amp;lt; Begin Data Update;
For Each({colname}, cols,
	For Each Row(dt,
		s = Char(Column(dt, colname)[]);
		If(Column(dt, colname)[] &amp;lt; 1000,
			s = "0" || s
		);
		Column(dt, colname)[] = In Format(Left(s, 2) || ":" || Right(s, 2), "hr:m");
	);
	Column(dt, colname) &amp;lt;&amp;lt; Format("hr:m", 30);
);
dt &amp;lt;&amp;lt; End Data Update;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just use the numbers and "convert" them to JMP time format&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Current Data Table();

cols = dt &amp;lt;&amp;lt; Get Column Names("String");

dt &amp;lt;&amp;lt; Begin Data Update;
For Each({colname}, cols,
	For Each Row(dt,
		val = Column(dt, colname)[];
		h = Floor(val / 100);
		m = Mod(val, 100);
		t = h * In Hours(1) + m * In Minutes(1);
		Column(dt, colname)[] = t;
	);
	Column(dt, colname) &amp;lt;&amp;lt; Format("hr:m", 30);
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Apr 2026 20:11:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944930#M109634</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-04-28T20:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944935#M109635</link>
      <description>&lt;P&gt;And the last method can be quite easily done from JMP interactively also.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Select all columns&lt;/P&gt;
&lt;P&gt;2. Right click on column header&lt;/P&gt;
&lt;P&gt;3. Create Formula quick column&lt;/P&gt;
&lt;P&gt;4. Replace the formula using the relative styling&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;h = Floor(_relative_from_Col 1 / 100);
m = Mod(_relative_from_Col 1, 100);
t = h * In Hours(1) + m * In Minutes(1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;5. Change output to In Place Data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1777407830711.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101392i0FD5BBE75672B8B4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1777407830711.png" alt="jthi_1-1777407830711.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;6. Click "Replace x"&lt;/P&gt;
&lt;P&gt;7. Change format to duration hr:m using Standardize Attributes as currently you just have seconds visible with Best formatting&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1777407889531.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101393i4DA74827641A5E9D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1777407889531.png" alt="jthi_2-1777407889531.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;8. After clicking OK or Apply&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_3-1777407903629.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101394i8E16CC2B488A6B86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_3-1777407903629.png" alt="jthi_3-1777407903629.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And JMP is nice enough to write script for you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Transform column
Data Table("example for JMP com") &amp;lt;&amp;lt; Apply Formula(
	Columns(Group(:Col 1, 2), Ref("_relative_from_Col 1")),
	Formula(
		h = Floor(_relative_from_Col 1 / 100);
		m = Mod(_relative_from_Col 1, 100);
		t = h * In Hours(1) + m * In Minutes(1);
	),
	Output("In Place")
) &amp;lt;&amp;lt; Run Formulas;


// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com"));
	For Each({col, index}, {:Col 1, :Col 2}, col &amp;lt;&amp;lt; Format("hr:m", 10));
	Current Data Table(old dt);
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2026 20:26:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944935#M109635</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-04-28T20:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944972#M109636</link>
      <description>&lt;P&gt;Here is how I would do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Current Data Table();

colNames = dt &amp;lt;&amp;lt; get column names( contiuous, string );
For Each( {col}, colNames,
	Show( col );
	For Each Row(
		As Column( col ) = Informat(
			Substr( Char( As Column( Col ) ), 1, Length( Char( As Column( Col ) ) ) - 2 ) || ":" ||
			Substr( Char( As Column( Col ) ), Length( Char( As Column( Col ) ) ) - 1, 2 ),
			"hr:m"
		)
	);
	column(dt,col) &amp;lt;&amp;lt; format( "hr:m" );
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2026 03:38:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944972#M109636</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2026-04-29T03:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944993#M109637</link>
      <description>&lt;P&gt;Hi Jarmo,&amp;nbsp; thank you so much!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your first script works magic!&lt;/P&gt;
&lt;P&gt;Except that sometimes, I just realized, the time is entered as hh:mm:ss&lt;/P&gt;
&lt;P&gt;Is there a way to work around this as well? See example v2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers, C&lt;/P&gt;
&lt;P&gt;P.S. I owe you a coffee or beer the next time I see you!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2026 07:58:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944993#M109637</guid>
      <dc:creator>Stats_Like_Jazz</dc:creator>
      <dc:date>2026-04-29T07:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944999#M109638</link>
      <description>&lt;P&gt;If that is from real data (character columns with different formats)? Original example had numeric data if I remember correctly. Are the seconds always 00 as they are in the example?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2026 08:05:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/944999#M109638</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-04-29T08:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/945046#M109639</link>
      <description>&lt;P&gt;Yes, unfortunately, this is from the real data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had selected two columns that did not have this issue, as I thought I could just use recode.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I thought wrong, or at least I realized that using recode on 84 columns is too much for what I can bear.&lt;/P&gt;
&lt;P&gt;Yes, the seconds are always 00.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2026 12:48:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/945046#M109639</guid>
      <dc:creator>Stats_Like_Jazz</dc:creator>
      <dc:date>2026-04-29T12:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix a duration with missing colon :</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/945056#M109640</link>
      <description>&lt;P&gt;Formula for the quick formula method when the columns are character columns. This makes assumption that values which are already duration "formatted" will have zero padding for hour (such as&amp;nbsp;&lt;STRONG&gt;0&lt;/STRONG&gt;9:00:00)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;numonly = Substitute(_relative_from_X__1, ":", ""); // remove ":"
hrm = Left(numonly, 4); // take 4 characters from left
val = Num(hrm); // convert to numeric for calculations
h = Floor(val / 100); // take only hundreds
m = Mod(val, 100); // remainder
t = h * 60*60 + m * 60; // convert to seconds&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1777467028211.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101460i4400AB2E6EEE7939/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1777467028211.png" alt="jthi_1-1777467028211.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I create new columns here so I can easily compare them to the starting point. After creating formulas, do required type changes using standardize attributes (data type, modeling type, format)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_2-1777467219709.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/101461i5FDF08F5953F9084/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_2-1777467219709.png" alt="jthi_2-1777467219709.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;This will create new data columns, you might want to use in place data instead&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Transform column
Data Table("example for JMP com v2") &amp;lt;&amp;lt; Apply Formula(
	Columns(Group(:X__1, 12), Ref("_relative_from_X__1")),
	Formula(
		numonly = Substitute(_relative_from_X__1, ":", "");
		hrm = Left(numonly, 4);
		val = Num(hrm);
		h = Floor(val / 100);
		m = Mod(val, 100);
		t = h * 60 * 60 + m * 60;
	),
	Output(New Static)
) &amp;lt;&amp;lt; Run Formulas;


// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com v2"));
	For Each({col, index},
		{:X__1 2, :X__2 2, :X__3 2, :X__4 2, :X__5 2, :X__6 2, :X__7 2, :X__8 2,
		:X__9 2, :X__10 2, :X__11 2, :X__12 2},
		col &amp;lt;&amp;lt; Set Data Type(Numeric, Format("Best", 12))
	);
	Current Data Table(old dt);
);

// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com v2"));
	For Each({col, index},
		{:X__1 2, :X__2 2, :X__3 2, :X__4 2, :X__5 2, :X__6 2, :X__7 2, :X__8 2,
		:X__9 2, :X__10 2, :X__11 2, :X__12 2},
		col &amp;lt;&amp;lt; Set Modeling Type("Continuous")
	);
	Current Data Table(old dt);
);

// Standardize column attributes
Local({old dt = Current Data Table()},
	Current Data Table(Data Table("example for JMP com v2"));
	For Each({col, index},
		{:X__1 2, :X__2 2, :X__3 2, :X__4 2, :X__5 2, :X__6 2, :X__7 2, :X__8 2,
		:X__9 2, :X__10 2, :X__11 2, :X__12 2},
		col &amp;lt;&amp;lt; Format("hr:m", 12)
	);
	Current Data Table(old dt);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2026 13:00:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-fix-a-duration-with-missing-colon/m-p/945056#M109640</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2026-04-29T13:00:23Z</dc:date>
    </item>
  </channel>
</rss>

