<?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 Date Time Formatting in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804241#M98172</link>
    <description>&lt;P&gt;I have a column with a few different date formats and also some blank dates. How do I revise the column to show one date column type for the different date types? Below is a screenshot of some of the values.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2024 15:09:39 GMT</pubDate>
    <dc:creator>dkraeuter_sunne</dc:creator>
    <dc:date>2024-10-08T15:09:39Z</dc:date>
    <item>
      <title>Date Time Formatting</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804241#M98172</link>
      <description>&lt;P&gt;I have a column with a few different date formats and also some blank dates. How do I revise the column to show one date column type for the different date types? Below is a screenshot of some of the values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:09:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804241#M98172</guid>
      <dc:creator>dkraeuter_sunne</dc:creator>
      <dc:date>2024-10-08T15:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Date Time Formatting</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804258#M98175</link>
      <description>&lt;P&gt;Here is one way to handle it&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1728404064222.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68901i31A47F5B90806876/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1728404064222.png" alt="txnelson_0-1728404064222.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt = New Table( "Example",
	Add Rows( 2 ),
	New Column( "datetime",
		Character,
		"Nominal",
		Set Values( {"2023-05-10 17:47:36.005390800+00:00", "6/6/2024 9:06"} ),
		Set Display Width( 230 )
	)
);

New Column( "new datetime", Numeric, "Continuous", Format( "m/d/y h:m:s", 23, 0 ) );

For Each Row(
	If( contains(:datetime, "+"),
		theDateTime = word(1,:datetime,"+");
		substitute into(theDateTime," ","T");
		:new datetime = informat(theDateTime,"yyyy-mm-ddThh:mm:ss");
		,
		contains(:datetime,"/"),
		:new datetime = informat(:datetime,"m/d/y h:m")
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2024 16:14:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804258#M98175</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-10-08T16:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Date Time Formatting</title>
      <link>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804277#M98180</link>
      <description>&lt;P&gt;I would go with something similar as Jim. Use If-statement to check which format you are currently handling and then use &lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/date-and-time-functions.shtml?os=win&amp;amp;source=application#ww3227692" target="_self"&gt;InFormat()&lt;/A&gt; to turn it into a numeric value&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Example",
	Add Rows(2),
	New Column("datetime",
		Character,
		"Nominal",
		Set Values({"2023-05-10 17:47:36.005390800+00:00", "6/6/2024 9:06"})
	)
);

// If you wish to keep milliseconds some extra stuff is needed
dt &amp;lt;&amp;lt; new column("date", numeric, continuous, Format("Locale Date Time h:m:s", 23, 0),
	Formula(
		If(Contains(:datetime, "+"),
			pattern = "&amp;lt;YYYY&amp;gt;-&amp;lt;MM&amp;gt;-&amp;lt;DD&amp;gt; &amp;lt;hh24&amp;gt;:&amp;lt;mm&amp;gt;:&amp;lt;ss&amp;gt;";
		,
			pattern = "&amp;lt;DD&amp;gt;/&amp;lt;MM&amp;gt;/&amp;lt;YYYY&amp;gt; &amp;lt;hh24&amp;gt;:&amp;lt;mm&amp;gt;";
		);
		In Format(
			Word(1, :datetime, "."),
			"Format Pattern",
			pattern
		);
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2024 16:51:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-Time-Formatting/m-p/804277#M98180</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-08T16:51:55Z</dc:date>
    </item>
  </channel>
</rss>

