<?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 Informat (ParseDate) function with time in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470283#M71440</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about Informat function (or its alias ParseDate). If I have a string with date and time information, and I try to parse date on JMP 15.2.0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;str="2022-10-22 16:25:37";

datetime= Informat( str, "yyyy-mm-dd HH:mm:ss" );
show(type(datetime));
show(datetime);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get output different kind of outputs, depending on date time settings (Win 10).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regional format English (United Kingdom):&lt;BR /&gt;str = "2022-10-22 16:23:37";&lt;BR /&gt;Type(datetime) = "Date";&lt;BR /&gt;datetime = 22Oct2022:16:23:37;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or Regional format Finnish (Finland):&lt;/P&gt;&lt;P&gt;str = "2022-10-22 16:23:37";&lt;BR /&gt;Type(datetime) = "Number";&lt;BR /&gt;datetime = .;&lt;BR /&gt;&lt;BR /&gt;Is there a function that could parse time also? Or are there suggestions how this could be done?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 18:13:20 GMT</pubDate>
    <dc:creator>jueefo</dc:creator>
    <dc:date>2023-06-09T18:13:20Z</dc:date>
    <item>
      <title>Informat (ParseDate) function with time</title>
      <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470283#M71440</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question about Informat function (or its alias ParseDate). If I have a string with date and time information, and I try to parse date on JMP 15.2.0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;str="2022-10-22 16:25:37";

datetime= Informat( str, "yyyy-mm-dd HH:mm:ss" );
show(type(datetime));
show(datetime);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get output different kind of outputs, depending on date time settings (Win 10).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regional format English (United Kingdom):&lt;BR /&gt;str = "2022-10-22 16:23:37";&lt;BR /&gt;Type(datetime) = "Date";&lt;BR /&gt;datetime = 22Oct2022:16:23:37;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or Regional format Finnish (Finland):&lt;/P&gt;&lt;P&gt;str = "2022-10-22 16:23:37";&lt;BR /&gt;Type(datetime) = "Number";&lt;BR /&gt;datetime = .;&lt;BR /&gt;&lt;BR /&gt;Is there a function that could parse time also? Or are there suggestions how this could be done?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:13:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470283#M71440</guid>
      <dc:creator>jueefo</dc:creator>
      <dc:date>2023-06-09T18:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Informat (ParseDate) function with time</title>
      <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470316#M71444</link>
      <description>&lt;P&gt;Check out if using &amp;lt;&amp;lt; Use Locale() helps at all.&lt;/P&gt;
&lt;P&gt;JMP was fairly bad at managing managing time (and dates) before JMP16. I would most likely parse the string to year, month, day, hour, minute and second. Then sum those to get date_time. With JMP16 you could most likely just use Format Pattern&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe this can give some ideas:&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);

str = "2022-10-22 16:25:37";

date = Word(1, str, " ");
time = Word(2, str, " ");
y = Num(Word(1, date, "-"));
m = Num(Word(2, date, "-"));
d = Num(Word(3, date, "-"));

time_separator = Left(Regex(Format(Today(), "h:m:s"), "\d", "", GLOBALREPLACE), 1);

hh = Num(Word(1, time, time_separator));
mm = Num(Word(2, time, time_separator));
ss = Num(Word(3, time, time_separator));

date_time = Date DMY(d, m, y) + hh * 60 * 60 + mm * 60 + ss;
AsDate(date_time);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 15:18:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470316#M71444</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-03-16T15:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Informat (ParseDate) function with time</title>
      <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470322#M71447</link>
      <description>&lt;P&gt;Here is one way to handle the issue&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;str="2022-10-22 16:25:37";

datetime = datemdy(num(word(2,str," -:")),
	num(word(3,str," -:")),
	num(word(1,str," -:")) ) +
	3600*num(word(4,str," -:")) +
	60 * num(word(5,str," -:")) +
	num(word(6,str," -:")
);
show(format(datetime,"m/d/y h:m:s"));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It shows in the log&lt;/P&gt;
&lt;PRE&gt;Format(datetime, "m/d/y h:m:s") = "10/22/2022 4:25:37 PM";&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Mar 2022 15:28:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470322#M71447</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-03-16T15:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Informat (ParseDate) function with time</title>
      <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470742#M71489</link>
      <description>&lt;P&gt;I have used&amp;nbsp;&lt;SPAN&gt;&amp;lt;&amp;lt; Use Locale() to overcome issues with date and time formats. The example you provided did not solve issue, I&amp;nbsp; think that I come back to this later when I have time (pun intended). The issue with the example is most probably solved with &amp;lt;&amp;lt; Use Locale().&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I'll also try Format Pattern, if I get newer version of the JMP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again sharing your knowledge.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 12:45:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470742#M71489</guid>
      <dc:creator>jueefo</dc:creator>
      <dc:date>2022-03-17T12:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Informat (ParseDate) function with time</title>
      <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470743#M71490</link>
      <description>&lt;P&gt;Thank you, this example works for the datetime settings tested.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 12:49:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/470743#M71490</guid>
      <dc:creator>jueefo</dc:creator>
      <dc:date>2022-03-17T12:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Informat (ParseDate) function with time</title>
      <link>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/736131#M91680</link>
      <description>&lt;P&gt;It seems that in Jmp 15.2 Informat just ignored fancy patterns like&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;datetime= Informat( str, "yyyy-mm-dd HH:mm:ss" );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Even pattern = "hello" results in&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1710792939811.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/62313i6A4D60AB68096A39/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1710792939811.png" alt="hogi_0-1710792939811.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In later versions, Jmp will tell the user:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;Unknown format: hello&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What works:&lt;BR /&gt;&lt;STRONG&gt;Informat&lt;/STRONG&gt; with the option &lt;FONT face="courier new,courier"&gt;Format Pattern&lt;/FONT&gt;:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;str="2022-10-22 16:25:37";
datetime= Informat( str, "Format Pattern", "&amp;lt;YYYY&amp;gt;&amp;lt;/&amp;gt;&amp;lt;MM&amp;gt;&amp;lt;/&amp;gt;&amp;lt;DD&amp;gt; &amp;lt;hh&amp;gt;&amp;lt;:&amp;gt;&amp;lt;mm&amp;gt;&amp;lt;:&amp;gt;&amp;lt;ss&amp;gt;" );
show(type(datetime));
show(datetime);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Mar 2024 20:16:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Informat-ParseDate-function-with-time/m-p/736131#M91680</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-03-18T20:16:58Z</dc:date>
    </item>
  </channel>
</rss>

