<?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 Need help converting a date format from character to numeric in JMP 15 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356131#M60603</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Excel sheet has the date format as:&amp;nbsp;Wednesday, November 18, 2020, 12:45:00 PM. Upon importing into JMP 15, it is read as a character.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Can you please share a method to convert the date from its character format to a numeric-continuous format (e.g., yyyy-mm-dd hh:mm)? I have attached a JMP file for your reference.&lt;/LI&gt;&lt;LI&gt;Is there is a way to apply the correct (numeric) date format during import?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 23:25:43 GMT</pubDate>
    <dc:creator>sumit_dutta</dc:creator>
    <dc:date>2023-06-10T23:25:43Z</dc:date>
    <item>
      <title>Need help converting a date format from character to numeric in JMP 15</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356131#M60603</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Excel sheet has the date format as:&amp;nbsp;Wednesday, November 18, 2020, 12:45:00 PM. Upon importing into JMP 15, it is read as a character.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Can you please share a method to convert the date from its character format to a numeric-continuous format (e.g., yyyy-mm-dd hh:mm)? I have attached a JMP file for your reference.&lt;/LI&gt;&lt;LI&gt;Is there is a way to apply the correct (numeric) date format during import?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:25:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356131#M60603</guid>
      <dc:creator>sumit_dutta</dc:creator>
      <dc:date>2023-06-10T23:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting a date format from character to numeric in JMP 15</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356171#M60606</link>
      <description>&lt;P&gt;Here is a brute force method for getting what you want.&amp;nbsp; I have attached the complete data table.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="convert.PNG" style="width: 765px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/30023i6A601791FB6627B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="convert.PNG" alt="convert.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Row() == 1,
	monthList = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November",
	"December"}
);
myDate = Date MDY(
	Contains( monthList, Word( 2, :Name( "Current Date Format (character)" ), ", " ) ),
	Num( Word( 3, :Name( "Current Date Format (character)" ), ", " ) ),
	Num( Word( 4, :Name( "Current Date Format (character)" ), ", " ) )
);
If(
	Word( -1, :Name( "Current Date Format (character)" ), ", " ) == "PM" &amp;amp; Num(
		Word( 5, :Name( "Current Date Format (character)" ), ",: " )
	) &amp;lt; 12,
	myDate = myDate + Num( Word( 5, :Name( "Current Date Format (character)" ), ",: " ) ) * 3600 + 3600 * 12,
	myDate = myDate + Num( Word( 5, :Name( "Current Date Format (character)" ), ",: " ) ) * 3600
);
myDate = myDate + Num( Word( 6, :Name( "Current Date Format (character)" ), ",: " ) ) * 60 + Num(
	Word( 7, :Name( "Current Date Format (character)" ), ",: " )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2021 19:37:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356171#M60606</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-02-04T19:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need help converting a date format from character to numeric in JMP 15</title>
      <link>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356661#M60665</link>
      <description>&lt;P&gt;Here comes another possibility using regex, probably the shortest implementation would be version 2 below, using additionally informat() in a formula. Once you read the information from the date string, there are many ways to convert it into a numerical date.&lt;/P&gt;&lt;P&gt;If you have the date numerically in Excel, it would be better, to change format in Excel such that JMP can read.&lt;/P&gt;&lt;P&gt;regex is great, I love it!&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 );

// AA for conversion of month
month_AA = Associative Array(
	{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"},
	{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"}
);

date_str = "Wednesday, November 18, 2020, 12:45:00 PM";
date_str = "Friday, November 20, 2020, 8:10:00 AM";
regex_str = "(\w+), (\w+) (\d+), (\d+), (\d+):(\d+):(\d+) (PM|AM)";

// 1st version generating a list and building string thereof 
date_component_lst = Regex Match( date_str, regex_str );
date_component_lst[6] = char(num(date_component_lst[6]) + match(date_component_lst[9], "AM", 0, "PM", 12));
date_str1 = date_component_lst[5] || "-" || month_AA[date_component_lst[3]] || "-" || date_component_lst[4] || "T" || date_component_lst[6] || ":"
 || date_component_lst[7] || ":" || date_component_lst[8];

// 2nd version generating a string, to be used by "Parse Date ()" do directly convert it into a date
date_str2 = Regex( date_str, regex_str, "\3 \2 \4 \5:\6:\7 \8" );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Feb 2021 16:18:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Need-help-converting-a-date-format-from-character-to-numeric-in/m-p/356661#M60665</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-02-06T16:18:24Z</dc:date>
    </item>
  </channel>
</rss>

