<?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: Convert Date/Time (down to the millseconds) into a Variable in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Convert-Date-Time-down-to-the-millseconds-into-a-Variable/m-p/367454#M61739</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9408"&gt;@Sully&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not exactly sure which part of your script wasn't behaving correctly as it did not run out of the box.&amp;nbsp; I made a few changes, can you see if this does what you need it to?&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);

dt1 = New Table( "Date test",
	Add Rows( 1 ),
	New Column( "Column 1", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [] ) )
);

dt1 &amp;lt;&amp;lt; New Column ("Year", Formula(Year(Today())));  
dt1 &amp;lt;&amp;lt; New Column ("Month", Formula(Month(Today()))); 
dt1 &amp;lt;&amp;lt; New Column ("Day", Formula (Day(Today()))); 

//Original UpdateDate column
dt1 &amp;lt;&amp;lt; New Column ("UpdateDate", Character, "Nominal", Formula (Char( :Year ) || "-" || Char( :Month ) || "-" || Char( :Day ) || "-" ||
"12.20.00.000000"));

//Option 1 - adjusting your script
dt2 = dt1 &amp;lt;&amp;lt; Summary (
	Group (:UpdateDate), 
	Link to Original Data Table (0)
); 

dt2 &amp;lt;&amp;lt; Delete Columns ("N Rows"); 

//Get the UpdateDate and add single quotes to each line
date_id = dt2:UpdateDate &amp;lt;&amp;lt; Get Values; 
date_ids = list();
write("List of date_ids:");
for(i=1, i&amp;lt;= n items(date_id), i++,
	date_ids[i] = "'" || date_id[i]  || "'"; 
	write( "\!n" || date_ids[i] );
);

//Option 2 - include quotes in original column formula and then use associative array to find unique values
dt1 &amp;lt;&amp;lt; New Column ("UpdateDateQuoted", Character, "Nominal", Formula ("'" || Char( :Year ) || "-" || Char( :Month ) || "-" || Char( :Day ) || "-" ||
"12.20.00.000000'"));

date_ids_2 = associative array(dt1:UpdateDateQuoted) &amp;lt;&amp;lt; get keys;
write("\!n\!nDateID from associative array:\!n" || date_ids_2[1];)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Mar 2021 13:40:44 GMT</pubDate>
    <dc:creator>ih</dc:creator>
    <dc:date>2021-03-12T13:40:44Z</dc:date>
    <item>
      <title>Convert Date/Time (down to the millseconds) into a Variable</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-Date-Time-down-to-the-millseconds-into-a-Variable/m-p/365199#M61458</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to convert a date/time down to the milliseconds in order to insert into an SQL statement that I am using in my JSL script. The typical method I use to do so usually creates the variable (date) with single quotes around it. However, when attempting the same method to my date/time which includes milliseconds it adds two single quotes to each end of the variable. Could someone assist in potentially solving my issue, and/or helping pointing me in a different direction for the result I am looking for?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 = Current Data Table ();

dt1 &amp;lt;&amp;lt; New Column ("Year", Formula(Year(Today())));  
dt1 &amp;lt;&amp;lt; New Column ("Month", Formula(Month(Today()))); 
dt1 &amp;lt;&amp;lt; New Column ("Day", Formula (Day(Today()))); 

dt1 &amp;lt;&amp;lt; New Column ("UpdateDate", Formula (Char( :Year ) || "-" || Char( :Month ) || "-" || Char( :Day ) || "-" ||
"12.20.00.000000"));

dt2 = dt1 &amp;lt;&amp;lt; Summary (
	Group (:UpdateDate), 
	Link to Original Data Table (0)
); 

dt2 = current data table (); 

dt2 &amp;lt;&amp;lt; Delete Columns ("N Rows"); 

date_id = dt3:UpdateDate &amp;lt;&amp;lt; Get Values; 
date_ids = "'"||date_id||"'"; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The result I would like would be like this --&amp;gt; Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 420 StartFragment: 314 EndFragment: 388 StartSelection: 314 EndSelection: 314&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff00ff;"&gt;'2021-3-4-09.20.00.000000'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:07:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-Date-Time-down-to-the-millseconds-into-a-Variable/m-p/365199#M61458</guid>
      <dc:creator>Sully</dc:creator>
      <dc:date>2023-06-09T22:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Date/Time (down to the millseconds) into a Variable</title>
      <link>https://community.jmp.com/t5/Discussions/Convert-Date-Time-down-to-the-millseconds-into-a-Variable/m-p/367454#M61739</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9408"&gt;@Sully&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not exactly sure which part of your script wasn't behaving correctly as it did not run out of the box.&amp;nbsp; I made a few changes, can you see if this does what you need it to?&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);

dt1 = New Table( "Date test",
	Add Rows( 1 ),
	New Column( "Column 1", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [] ) )
);

dt1 &amp;lt;&amp;lt; New Column ("Year", Formula(Year(Today())));  
dt1 &amp;lt;&amp;lt; New Column ("Month", Formula(Month(Today()))); 
dt1 &amp;lt;&amp;lt; New Column ("Day", Formula (Day(Today()))); 

//Original UpdateDate column
dt1 &amp;lt;&amp;lt; New Column ("UpdateDate", Character, "Nominal", Formula (Char( :Year ) || "-" || Char( :Month ) || "-" || Char( :Day ) || "-" ||
"12.20.00.000000"));

//Option 1 - adjusting your script
dt2 = dt1 &amp;lt;&amp;lt; Summary (
	Group (:UpdateDate), 
	Link to Original Data Table (0)
); 

dt2 &amp;lt;&amp;lt; Delete Columns ("N Rows"); 

//Get the UpdateDate and add single quotes to each line
date_id = dt2:UpdateDate &amp;lt;&amp;lt; Get Values; 
date_ids = list();
write("List of date_ids:");
for(i=1, i&amp;lt;= n items(date_id), i++,
	date_ids[i] = "'" || date_id[i]  || "'"; 
	write( "\!n" || date_ids[i] );
);

//Option 2 - include quotes in original column formula and then use associative array to find unique values
dt1 &amp;lt;&amp;lt; New Column ("UpdateDateQuoted", Character, "Nominal", Formula ("'" || Char( :Year ) || "-" || Char( :Month ) || "-" || Char( :Day ) || "-" ||
"12.20.00.000000'"));

date_ids_2 = associative array(dt1:UpdateDateQuoted) &amp;lt;&amp;lt; get keys;
write("\!n\!nDateID from associative array:\!n" || date_ids_2[1];)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Mar 2021 13:40:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Convert-Date-Time-down-to-the-millseconds-into-a-Variable/m-p/367454#M61739</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-03-12T13:40:44Z</dc:date>
    </item>
  </channel>
</rss>

