<?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: Short Date () creating a locked character column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237292#M46857</link>
    <description>&lt;P&gt;You can also do it using only the number by changing date time from seconds to days and flooring.&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( "Test",
	Add Rows( 1 ),
	New Column( "DateTime",
		Numeric,
		"Continuous",
		Format( "m/d/y h:m:s", 23, 0 ),
		Formula( Today() ),
	)
);


dt &amp;lt;&amp;lt; New Column("Date", 
	Numeric,
	"Continuous",
	Format( "m/d/y", 23 ),
	Formula( 
		num_s_per_day = 24*60*60; // # seconds/day
		Floor(
			:DateTime // take the date time which is a number in seconds
			/ num_s_per_day // turn it into days by dividing 
		) // this will round down to the day
		* num_s_per_day // turn it back into seconds (a date time)
	),
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Dec 2019 16:44:49 GMT</pubDate>
    <dc:creator>vince_faller</dc:creator>
    <dc:date>2019-12-04T16:44:49Z</dc:date>
    <item>
      <title>Short Date () creating a locked character column</title>
      <link>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237143#M46826</link>
      <description>&lt;P&gt;When I create a "date" column in the script below it creates a locked (so I can not change the format) column.&amp;nbsp; Short Date() in the formula looks to be the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The time column stays as numeric after the formula is applied.&lt;/P&gt;&lt;P&gt;How do I get the "Date" to stay numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The date is later in a calender() to set the calender to show only days there is data present.&lt;/P&gt;&lt;P&gt;_____________________________________________________&lt;/P&gt;&lt;PRE&gt;//Open
dt_run = Open( "data.jmp");

dt_run &amp;lt;&amp;lt; New Column( "Date", Numeric, Continuous, Format("m/d/y"), Input Format( "m/d/y h:m:s"));
Column( "Date") &amp;lt;&amp;lt; Add Column Properties( Formula( Short Date( :Name( "Date &amp;amp; Time" ) ) ) );

dt_run &amp;lt;&amp;lt; New Column( "Time", Numeric, Continuous, Format("h:m"), Input Format( "m/d/y h:m:s"));
Column( "Time") &amp;lt;&amp;lt; Add Column Properties( Formula( Time Of Day( :Name( "Date &amp;amp; Time" ) ) ) );&lt;/PRE&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 23:47:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237143#M46826</guid>
      <dc:creator>Matt_C</dc:creator>
      <dc:date>2019-12-03T23:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Short Date () creating a locked character column</title>
      <link>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237156#M46827</link>
      <description>&lt;P&gt;The issues you are having are with the understanding of what the Short Date() function returns.&amp;nbsp; It does not return a JMP date value, which would be the number of seconds since 12:00am, January 1, 1904, but rather, it returns a literal string of the date part of a JMP date value.&amp;nbsp; To illustrate this, the following JSL displays what Short Date() returns:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;show(short date(today()));	&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;and it returns&lt;/P&gt;
&lt;PRE&gt;Short Date(Today()) = "12/03/2019";&lt;/PRE&gt;
&lt;P&gt;And since in your JSL it returned a literal string, it changed the Date column to a character column. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really, what you want is to use the DateMDY() function to create the date value.&lt;/P&gt;
&lt;P&gt;Below is a reworked version of your code that does what I believe you need:&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_run = new table("data",add rows(1), new column("Date &amp;amp; Time",formula(today()),format("m/d/y h:m:s")));

dt_run &amp;lt;&amp;lt; New Column( "Date", Numeric, Continuous, Format("m/d/y"));
Column( "Date") &amp;lt;&amp;lt; set Formula( DateMDY(Month(:Name( "Date &amp;amp; Time" )),Day(:Name( "Date &amp;amp; Time" )),Year(:Name( "Date &amp;amp; Time" )) ) );

dt_run &amp;lt;&amp;lt; New Column( "Time", Numeric, Continuous, Format("h:m"));
Column( "Time") &amp;lt;&amp;lt; set Formula( Time Of Day( :Name( "Date &amp;amp; Time" ) ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 04:54:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237156#M46827</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-12-04T04:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Short Date () creating a locked character column</title>
      <link>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237278#M46854</link>
      <description>Jim,&lt;BR /&gt;Thanks for such a well explained answer. Your posts are always informative, educational and easy to follow.&lt;BR /&gt;Matt</description>
      <pubDate>Wed, 04 Dec 2019 16:12:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237278#M46854</guid>
      <dc:creator>Matt_C</dc:creator>
      <dc:date>2019-12-04T16:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Short Date () creating a locked character column</title>
      <link>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237290#M46856</link>
      <description>&lt;P&gt;Given a little more thought on your JSL.......you could use the following to get your Date column populated&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Column( "Date") &amp;lt;&amp;lt; set Formula( informat(Short Date( :Name( "Date &amp;amp; Time" ) ), "mm/dd/yyyy") );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It just uses the Informat() function, which takes a literal string and returns a numeric JMP Date value&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 16:40:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237290#M46856</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-12-04T16:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Short Date () creating a locked character column</title>
      <link>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237292#M46857</link>
      <description>&lt;P&gt;You can also do it using only the number by changing date time from seconds to days and flooring.&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( "Test",
	Add Rows( 1 ),
	New Column( "DateTime",
		Numeric,
		"Continuous",
		Format( "m/d/y h:m:s", 23, 0 ),
		Formula( Today() ),
	)
);


dt &amp;lt;&amp;lt; New Column("Date", 
	Numeric,
	"Continuous",
	Format( "m/d/y", 23 ),
	Formula( 
		num_s_per_day = 24*60*60; // # seconds/day
		Floor(
			:DateTime // take the date time which is a number in seconds
			/ num_s_per_day // turn it into days by dividing 
		) // this will round down to the day
		* num_s_per_day // turn it back into seconds (a date time)
	),
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Dec 2019 16:44:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Short-Date-creating-a-locked-character-column/m-p/237292#M46857</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2019-12-04T16:44:49Z</dc:date>
    </item>
  </channel>
</rss>

