<?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: Date format error for 2020 in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/292883#M55622</link>
    <description>&lt;P&gt;Great, and you're welcome! Glad that is working for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The regex(...) might not be needed if your data is all the same format. In the original question, some values had seconds and some did not. By keeping only the hours and minutes, the hh:mm format would work for all of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The important part is to specify the proper format to read the dates.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2020 21:54:33 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2020-08-27T21:54:33Z</dc:date>
    <item>
      <title>Date format error for 2020</title>
      <link>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/249114#M48918</link>
      <description>&lt;P&gt;I have a set of data where I have a couple different formats for dates and I am creating a new column to convert the dates to one format.&amp;nbsp; The dates are in d/m/y h:m:s format.&amp;nbsp; When I run the script all of the 2019 dates translate fine, but the 2020 dates get their month day reversed.&amp;nbsp; If I go into column information and change the settings manually it works fine.&amp;nbsp; What can I do within JSL to retain the correct format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DateTime&lt;/P&gt;&lt;P&gt;5/1/2020 1:10&lt;BR /&gt;5/1/2020 1:10&lt;BR /&gt;5/1/2020 1:10&lt;BR /&gt;30-12-2019 14:01:18&lt;BR /&gt;30-12-2019 14:01:18&lt;BR /&gt;30-12-2019 14:01:18&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New Column("DateTime2",numeric,"Continuous",format("d/m/y h:m:s",22,0),input format("d/m/y h:m:s",0));&lt;/P&gt;&lt;P&gt;for each row( :DateTime2 = num(:DateTime));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DateTime DateTime2&lt;BR /&gt;5/1/2020 1:10 &lt;FONT color="#FF0000"&gt;01/05/&lt;/FONT&gt;2020 1:10:00 AM&lt;BR /&gt;5/1/2020 1:10 &lt;FONT color="#FF0000"&gt;01/05/&lt;/FONT&gt;2020 1:10:00 AM&lt;BR /&gt;5/1/2020 1:10 &lt;FONT color="#FF0000"&gt;01/05/&lt;/FONT&gt;2020 1:10:00 AM&lt;BR /&gt;30-12-2019 14:01:18 &lt;FONT color="#339966"&gt;30/12/&lt;/FONT&gt;2019 2:01:18 PM&lt;BR /&gt;30-12-2019 14:01:18 &lt;FONT color="#339966"&gt;30/12/&lt;/FONT&gt;2019 2:01:18 PM&lt;BR /&gt;30-12-2019 14:01:18 &lt;FONT color="#339966"&gt;30/12/&lt;/FONT&gt;2019 2:01:18 PM&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 00:29:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/249114#M48918</guid>
      <dc:creator>jshaw04</dc:creator>
      <dc:date>2020-02-26T00:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date format error for 2020</title>
      <link>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/249137#M48922</link>
      <description>&lt;P&gt;Your input date is character data, and you are using the num() function to guess the date's format. Use the informat function and specify the format. Some of your data has seconds and some doesn't. You can use regex to keep everything up to where the seconds might be. \d+ matches one or more digits and \D matches non-digit.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Informat( Regex( :datetime, "\d+\D\d+\D\d+\D\d+\D\d+" ), "d/m/y h:m" )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;JMP guesses m/d/y for ambiguous dates; the example dates you have for 2019 are not ambiguous.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="the datetime column is character data, column2 is a formula column" style="width: 657px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/21897i61195B5DC5A10368/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="the datetime column is character data, column2 is a formula column" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;the datetime column is character data, column2 is a formula column&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Column 2 formula" style="width: 788px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/21899iCDF3C52B641CD3BE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Column 2 formula" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Column 2 formula&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 03:25:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/249137#M48922</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2020-02-26T03:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date format error for 2020</title>
      <link>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/249486#M48992</link>
      <description>&lt;P&gt;Thank you Craige.&amp;nbsp; You are correct, the dates were not ambiguous due to end of year inputs for 2019.&amp;nbsp; Good catch.&lt;/P&gt;&lt;P&gt;I wouldn't have thought about the Regex, so appreciate your insights there as well.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 16:30:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/249486#M48992</guid>
      <dc:creator>jshaw04</dc:creator>
      <dc:date>2020-02-27T16:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date format error for 2020</title>
      <link>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/290951#M55602</link>
      <description>&lt;P&gt;Merci pour la formule.&lt;/P&gt;&lt;P&gt;J'ai eu besoin des secondes, j'ai donc mis&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Informat(
	Regex( :Name( "Time-court" ), "\d+\D\d+\D\d+\D\d+\D\d+\D\d+" ),
	"d/m/y h:m:s:sc"
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Aug 2020 15:02:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/290951#M55602</guid>
      <dc:creator>nath_baillet</dc:creator>
      <dc:date>2020-08-27T15:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date format error for 2020</title>
      <link>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/292883#M55622</link>
      <description>&lt;P&gt;Great, and you're welcome! Glad that is working for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The regex(...) might not be needed if your data is all the same format. In the original question, some values had seconds and some did not. By keeping only the hours and minutes, the hh:mm format would work for all of them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The important part is to specify the proper format to read the dates.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 21:54:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-format-error-for-2020/m-p/292883#M55622</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2020-08-27T21:54:33Z</dc:date>
    </item>
  </channel>
</rss>

