<?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 function in jsl. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57404#M32118</link>
    <description>&lt;P&gt;This piece of script isnt working for me.&lt;/P&gt;&lt;P&gt;the " today() - Indays(7) part works but something wrong with Date comparision.&lt;/P&gt;&lt;P&gt;Debugger doesnt show any error but nothing happens when I run this. I am using JMP 12. Is that a problem?&lt;/P&gt;</description>
    <pubDate>Fri, 18 May 2018 21:56:32 GMT</pubDate>
    <dc:creator>ENTHU</dc:creator>
    <dc:date>2018-05-18T21:56:32Z</dc:date>
    <item>
      <title>Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57122#M32043</link>
      <description>&lt;P&gt;I have a table with that has time stamp for all the rows.&lt;/P&gt;&lt;P&gt;But I need only last 7 days data. Is there an easy way to delete all data that is past last 7 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New to jsl and any inputs will be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 00:18:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57122#M32043</guid>
      <dc:creator>ENTHU</dc:creator>
      <dc:date>2018-05-17T00:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57130#M32051</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; select where( today() - In Days( 7 ) &amp;lt; :Your date column );
dt &amp;lt;&amp;lt; delete rows;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This will select all rows where your date column(replace its name in the first line of the JSL), is less than the current datetime - 7 days.&amp;nbsp; Then the delete rows will delete all selected rows.&lt;/P&gt;
&lt;P&gt;If you want the rows to be deleted to be 7 days prior to midnight, not 7 days before this point in time (today()), then you need to subtact the current time from the today() functions value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; select where( today() - Time of Day( today() ) - In Days( 7 ) &amp;lt; :Your date column );
dt &amp;lt;&amp;lt; delete rows;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 01:30:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57130#M32051</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-05-17T01:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57404#M32118</link>
      <description>&lt;P&gt;This piece of script isnt working for me.&lt;/P&gt;&lt;P&gt;the " today() - Indays(7) part works but something wrong with Date comparision.&lt;/P&gt;&lt;P&gt;Debugger doesnt show any error but nothing happens when I run this. I am using JMP 12. Is that a problem?&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 21:56:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57404#M32118</guid>
      <dc:creator>ENTHU</dc:creator>
      <dc:date>2018-05-18T21:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57409#M32122</link>
      <description>&lt;P&gt;I don't have JMP 12 available to me to verify if In Days() function is available.&amp;nbsp; However, since all In Days() is doing is determining the number of seconds in a day, and then multiplying the result times the number in the (7), you can just change the formula to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;today()-7*60*60*24 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 May 2018 01:37:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57409#M32122</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-05-19T01:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57412#M32125</link>
      <description>&lt;P&gt;Thanks for the response.As I mentioned above, I created a new column and printed today() - In Days(7) which works perfectly fine.&lt;/P&gt;&lt;P&gt;After this if I try comparing 2 columns,I dont see any result/error. All date columns are numeric.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 02:13:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57412#M32125</guid>
      <dc:creator>ENTHU</dc:creator>
      <dc:date>2018-05-19T02:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57413#M32126</link>
      <description>&lt;P&gt;Can you show the exact code you are using that is not working, and could you supply a sample of your data table?&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 03:06:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57413#M32126</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-05-19T03:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57421#M32129</link>
      <description>&lt;P&gt;Here's the code -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Symbols();
Delete Symbols();
clear globals();

//Open master data list
S = Open("C:\Enthu\sample.xlsx","invisible");
 
current data table(S);
New Column( "START_SHORT_DATE", Numeric, Formula( Short Date( :start date ) ), );

New Column("Todays Date", Character,Formula(Abbrev Date(today())));

New Column("Ref Date", Character,Formula(Abbrev Date(today()-In Days(7))));
S &amp;lt;&amp;lt; select where( :Ref Date &amp;lt; :START_SHORT_DATE );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 15:56:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57421#M32129</guid>
      <dc:creator>ENTHU</dc:creator>
      <dc:date>2018-05-19T15:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57422#M32130</link>
      <description>&lt;P&gt;The problem is that the functions &lt;A href="https://www.jmp.com/support/help/14/date-and-time-functions.shtml#2548363" target="_blank"&gt;Short Date()&lt;/A&gt; and &lt;A href="https://www.jmp.com/support/help/14/date-and-time-functions.shtml#2533717" target="_blank"&gt;Abbrev Date() &lt;/A&gt;return character strings not date values. You can't compare a date value (which is numeric) to a character string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Column( "START_SHORT_DATE",
	Formula( :start date - Time Of Day( :start date ) ),
	Format( "m/d/y", 10 ),
);
New Column( "Todays Date",
	Formula( Today() - Time Of Day( Today() ) ),
	Format( "m/d/y", 10 )
);
New Column( "Ref Date",
	Formula( Today() - In Days( 7 ) ),
	Format( "m/d/y", 10 ), 

);

current data table() &amp;lt;&amp;lt; select where( :Ref Date &amp;lt; :START_SHORT_DATE );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 May 2018 17:44:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57422#M32130</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-05-19T17:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57552#M32131</link>
      <description>&lt;P&gt;I copied the exact same code and tried running.All columns are created properly.But the following line doesnt seem to work -&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;PRE class=" language-jsl"&gt;&lt;CODE class="  language-jsl"&gt;&lt;SPAN class="token function"&gt;current data table&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="token messages"&gt; select where&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;:&lt;/SPAN&gt;Ref Date &lt;SPAN class="token operator"&gt;&amp;lt;&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;:&lt;/SPAN&gt;START_SHORT_DATE &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Nothing gets selected.I tried using greater than , less than and equal to operators.Nothing seems to work.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 20:20:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57552#M32131</guid>
      <dc:creator>ENTHU</dc:creator>
      <dc:date>2018-05-19T20:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57557#M32132</link>
      <description>&lt;P&gt;Sorry I didn't catch this earlier. You'll need a Run Formulas() to ensure that all formulas are evaluated before the Select Where().&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Symbols();
Delete Symbols();
clear globals();

//Open master data list
S = Open("~/Downloads/sample.xlsx");

New Column( "START_SHORT_DATE",
	Formula( :start date - Time Of Day( :start date ) ),
	Format( "m/d/y", 10 ),
);
New Column( "Todays Date",
	Formula( Today() - Time Of Day( Today() ) ),
	Format( "m/d/y", 10 )
);
New Column( "Ref Date",
	Formula( Today() - In Days( 7 ) ),
	Format( "m/d/y", 10 ), 

);
s &amp;lt;&amp;lt; run formulas();
s &amp;lt;&amp;lt; select where( :Ref Date &amp;lt; :START_SHORT_DATE );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;BTW: You don't really need all the formula columns to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Clear Symbols();
Delete Symbols();
Clear Globals();

//Open master data list
S = Open( "~/Downloads/sample.xlsx" );

s &amp;lt;&amp;lt; select where(
	(Today() - Time Of Day( Today() ) - In Days( 7 )) &amp;lt; :start date - Time Of Day( :start date )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 May 2018 20:48:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57557#M32132</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2018-05-19T20:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date function in jsl.</title>
      <link>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57558#M32133</link>
      <description>&lt;P&gt;Here is a complete script that should show you a result&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
dt = New Table( "test",
	add rows( 100 ),
	New Column( "start date",
		formula( Random Uniform( Today() - In Days( 12 ), Today() ) ),
		Format( "m/d/y", 10 )
	)
);
dt:start date &amp;lt;&amp;lt; delete formula;


New Column( "START_SHORT_DATE",
	Formula( :start date - Time Of Day( :start date ) ),
	Format( "m/d/y", 10 ),

);
New Column( "Todays Date",
	Formula( Today() - Time Of Day( Today() ) ),
	Format( "m/d/y", 10 )
);
New Column( "Ref Date",
	Formula( Today() - In Days( 7 ) ),
	Format( "m/d/y", 10 ), 

);

Current Data Table() &amp;lt;&amp;lt; select where( :Ref Date &amp;lt; :START_SHORT_DATE );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 May 2018 20:48:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Date-function-in-jsl/m-p/57558#M32133</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-05-19T20:48:56Z</dc:date>
    </item>
  </channel>
</rss>

