<?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: Is there an easy way to know if a column is Date/Time? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/221840#M44266</link>
    <description>thank you for taking the time to post this code, it works great!</description>
    <pubDate>Thu, 15 Aug 2019 12:41:55 GMT</pubDate>
    <dc:creator>Arthur_Wesley</dc:creator>
    <dc:date>2019-08-15T12:41:55Z</dc:date>
    <item>
      <title>Is there an easy way to know if a column is Date/Time?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/17475#M15932</link>
      <description>&lt;P&gt;So I had a script that ran something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;for(i=1, i&amp;lt;=ncols(dt), i++,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = Column(dt, i) &amp;lt;&amp;lt; Get Name;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(contains(name, "Date") | contains(name, "Time"),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Run code
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, I've found that not all columns have "Date" or "Time" in the name.&amp;nbsp; Sometimes due to misspelling (like Tme, Tim, ect.)&amp;nbsp; Sometimes b/c it's just not included b/c the columns are arbitrarily named-"Column 1", "Value 2", ect.&amp;nbsp; &lt;BR /&gt;Anyways, I've been experimenting with '&amp;lt;&amp;lt; Get Format', but this doesn't seem to be consistent either.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Most of these files are coming from .csv generated by other programs.&amp;nbsp; Maybe there's a preference somewhere that would default Date formats to be a specific one of interest I could query?&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:21:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/17475#M15932</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2019-08-15T13:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an easy way to know if a column is Date/Time?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/17476#M15933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not aware of any "easy" way to determine that a column is a date value.&amp;nbsp; Your approach to use the &amp;lt;&amp;lt; get format, should provide the largest number of correct evaluations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Mar 2016 21:03:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/17476#M15933</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2016-03-15T21:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an easy way to know if a column is Date/Time?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/17477#M15934</link>
      <description>&lt;P&gt;Thanks for confirming what I feared.&amp;nbsp; I quickly wrote up this code if anyone has similar issues.&amp;nbsp; I am also open to other bright ideas.&amp;nbsp; Thanks!&lt;/P&gt;
&lt;P&gt;&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;isDate = Function({col}, {Default Local},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Insert Column (col) and returns 1 if column is a date, 0 if false.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format = char(col &amp;lt;&amp;lt; Get Format);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test = regex(format, "m/d/y|m/y|yyyy|y/m/d|Date|day|h:m|hr:m|min:s");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!ismissing(test),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(1),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:20:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/17477#M15934</guid>
      <dc:creator>msharp</dc:creator>
      <dc:date>2019-08-15T13:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an easy way to know if a column is Date/Time?</title>
      <link>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/221840#M44266</link>
      <description>thank you for taking the time to post this code, it works great!</description>
      <pubDate>Thu, 15 Aug 2019 12:41:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Is-there-an-easy-way-to-know-if-a-column-is-Date-Time/m-p/221840#M44266</guid>
      <dc:creator>Arthur_Wesley</dc:creator>
      <dc:date>2019-08-15T12:41:55Z</dc:date>
    </item>
  </channel>
</rss>

