<?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: Get date and time out of a text in a cell in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/544899#M76346</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Untitled", Add Rows( 1 ), New Column( "stamp", Character, "Nominal", Set Values( {"12.08.2022 15:46:43 GMT-0700"} ) ) );

dt &amp;lt;&amp;lt; New Column( "time", Format( "H:m:s" ), formula( Informat( Substr( stamp, 12, 8 ), "h:m:s" ) ) );
dt &amp;lt;&amp;lt; New Column( "date", Format( "d/m/y" ), formula( Informat( Substr( stamp, 1, 10 ), "d/m/y" ) ) );
dt &amp;lt;&amp;lt; New Column( "datetime1", Format( "d/m/y H:m:s" ), formula( Informat( Substr( stamp, 1, 19 ), "d/m/y H:m:s" ) ) );

dt &amp;lt;&amp;lt; New Column( "datetime2", Format( "yyyy-mm-ddThh:mm:ss" ), formula( Informat( Substr( stamp, 1, 19 ), "d/m/y H:m:s" ) ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Column formulas extract dates, times, and datetimes." style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45486iEC4767D99FF1742C/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.png" alt="Column formulas extract dates, times, and datetimes." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Column formulas extract dates, times, and datetimes.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually you'll want a datetime column, not separate date and time columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: I'm not sure where the formats are documented; I make a tiny data table, use the column properties to choose/test the format, then save the table script to a script window to grab the format name.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2022 02:28:06 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2022-09-15T02:28:06Z</dc:date>
    <item>
      <title>Get date and time out of a text in a cell</title>
      <link>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/544765#M76340</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a data set that reports the day and time within one cell in this format: "12.08.2022 15:46:43 GMT-0700" (the date format is dd.mm.yyyy).&amp;nbsp; I would like to create a column for the dates and a column for the time (I am going to assume that the time is the local time and the GMT-0700 is just indicating that is where the local time. So for each cell, I would like two columns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1: In date format: dd.mm.yyyy&lt;/P&gt;&lt;P&gt;Column 2: In time format 15:46:43&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The different approaches that I have tried dont' quite seem to work, and I am wondering if it is due to the period between the month/day/year values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using JMP 16.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:54:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/544765#M76340</guid>
      <dc:creator>rlangsner</dc:creator>
      <dc:date>2023-06-10T23:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get date and time out of a text in a cell</title>
      <link>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/544899#M76346</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Untitled", Add Rows( 1 ), New Column( "stamp", Character, "Nominal", Set Values( {"12.08.2022 15:46:43 GMT-0700"} ) ) );

dt &amp;lt;&amp;lt; New Column( "time", Format( "H:m:s" ), formula( Informat( Substr( stamp, 12, 8 ), "h:m:s" ) ) );
dt &amp;lt;&amp;lt; New Column( "date", Format( "d/m/y" ), formula( Informat( Substr( stamp, 1, 10 ), "d/m/y" ) ) );
dt &amp;lt;&amp;lt; New Column( "datetime1", Format( "d/m/y H:m:s" ), formula( Informat( Substr( stamp, 1, 19 ), "d/m/y H:m:s" ) ) );

dt &amp;lt;&amp;lt; New Column( "datetime2", Format( "yyyy-mm-ddThh:mm:ss" ), formula( Informat( Substr( stamp, 1, 19 ), "d/m/y H:m:s" ) ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Column formulas extract dates, times, and datetimes." style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/45486iEC4767D99FF1742C/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture.png" alt="Column formulas extract dates, times, and datetimes." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Column formulas extract dates, times, and datetimes.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually you'll want a datetime column, not separate date and time columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: I'm not sure where the formats are documented; I make a tiny data table, use the column properties to choose/test the format, then save the table script to a script window to grab the format name.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 02:28:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/544899#M76346</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-09-15T02:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get date and time out of a text in a cell</title>
      <link>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/545013#M76357</link>
      <description>&lt;P&gt;Thank you Craige. This worked exactly. You're right, I do want the time and date in one cell now that I think about it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 16:19:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/545013#M76357</guid>
      <dc:creator>rlangsner</dc:creator>
      <dc:date>2022-09-15T16:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Get date and time out of a text in a cell</title>
      <link>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/545045#M76358</link>
      <description>&lt;P&gt;If you get to the point where your local assumption isn't true.&amp;nbsp; It might be worth putting the times in UTC.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names default to here(1);
dt = New Table( "Untitled", Add Rows( 1 ), 
	New Column( "stamp", Character, "Nominal", Set Values( {
		"12.08.2022 15:46:43 GMT-0700", 
		"14.08.2022 15:46:43 GMT-0730" // just to show half hour time zones
	} ) ) 
);


dt &amp;lt;&amp;lt; New Column("DT UTC", Format( "yyyy-mm-ddThh:mm:ss" ), formula( 
	timezone_offset = Num( Substr( :stamp, 24, 3 ) ) + Num( Substr( :stamp, 27, 2 ) ) / 60; // get the timezone offset
	Informat( Substr( :stamp, 1, 19 ), "d/m/y H:m:s" ) - timezone_offset * 3600; // turn from local to UTC
 ));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Sep 2022 17:20:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Get-date-and-time-out-of-a-text-in-a-cell/m-p/545045#M76358</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2022-09-15T17:20:11Z</dc:date>
    </item>
  </channel>
</rss>

