<?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 Change date format in a script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Change-date-format-in-a-script/m-p/347732#M59865</link>
    <description>&lt;P&gt;I have a script that requires the user to input a batch creation time. It currently looks like this:&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;New Window( "BATCH_CREATE_TIME",
	&amp;lt;&amp;lt;modal(),
	Panel Box( "Enter BATCH_CREATE_TIME",
		Lineup Box( N Col( 1 ) ),
		number = Text Edit Box( "01/01/2021 09:00:00.000000" )
	),
	Panel Box( "Actions",
		H List Box(
			Button Box( "OK",
				keep_going = 1;
				BATCH_TIME = number &amp;lt;&amp;lt; Get text;
			),
			Button Box( "Cancel", keep_going = 0 )
		), 

	), 
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to update this so that it automatically puts the current time into the text box, so far I have this:&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;CurrTime = As Date(Today()); 

New Window( "BATCH_CREATE_TIME",
	&amp;lt;&amp;lt;modal(),
	Panel Box( "Enter BATCH_CREATE_TIME",
		Lineup Box( N Col( 1 ) ),
		number = Text Edit Box( CurrTime )
	),
	Panel Box( "Actions",
		H List Box(
			Button Box( "OK",
				keep_going = 1;
				BATCH_TIME = number &amp;lt;&amp;lt; Get text;
			),
			Button Box( "Cancel", keep_going = 0 )
		), 

	), 
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now all I want to do is change the output to match the original format. I currently get the format "01Jan2021:09:00:00". Ideally, I'd like this to be "01/01/2021 09:00:00.000000" (the decimal seconds aren't vital).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ways that I can change the format of the &lt;EM&gt;As Date&lt;/EM&gt; function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 22:03:01 GMT</pubDate>
    <dc:creator>HarriBradbeer</dc:creator>
    <dc:date>2023-06-09T22:03:01Z</dc:date>
    <item>
      <title>Change date format in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Change-date-format-in-a-script/m-p/347732#M59865</link>
      <description>&lt;P&gt;I have a script that requires the user to input a batch creation time. It currently looks like this:&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;New Window( "BATCH_CREATE_TIME",
	&amp;lt;&amp;lt;modal(),
	Panel Box( "Enter BATCH_CREATE_TIME",
		Lineup Box( N Col( 1 ) ),
		number = Text Edit Box( "01/01/2021 09:00:00.000000" )
	),
	Panel Box( "Actions",
		H List Box(
			Button Box( "OK",
				keep_going = 1;
				BATCH_TIME = number &amp;lt;&amp;lt; Get text;
			),
			Button Box( "Cancel", keep_going = 0 )
		), 

	), 
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to update this so that it automatically puts the current time into the text box, so far I have this:&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;CurrTime = As Date(Today()); 

New Window( "BATCH_CREATE_TIME",
	&amp;lt;&amp;lt;modal(),
	Panel Box( "Enter BATCH_CREATE_TIME",
		Lineup Box( N Col( 1 ) ),
		number = Text Edit Box( CurrTime )
	),
	Panel Box( "Actions",
		H List Box(
			Button Box( "OK",
				keep_going = 1;
				BATCH_TIME = number &amp;lt;&amp;lt; Get text;
			),
			Button Box( "Cancel", keep_going = 0 )
		), 

	), 
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now all I want to do is change the output to match the original format. I currently get the format "01Jan2021:09:00:00". Ideally, I'd like this to be "01/01/2021 09:00:00.000000" (the decimal seconds aren't vital).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ways that I can change the format of the &lt;EM&gt;As Date&lt;/EM&gt; function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:03:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-date-format-in-a-script/m-p/347732#M59865</guid>
      <dc:creator>HarriBradbeer</dc:creator>
      <dc:date>2023-06-09T22:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change date format in a script</title>
      <link>https://community.jmp.com/t5/Discussions/Change-date-format-in-a-script/m-p/347756#M59869</link>
      <description>&lt;P&gt;Your input field is a text box, so you need to convert the date from a numeric number of seconds, to a string using a format() function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;CurrTime = format(As Date(Today()),"m/d/y h:m:s",6) ; 

New Window( "BATCH_CREATE_TIME",
	&amp;lt;&amp;lt;modal(),
	Panel Box( "Enter BATCH_CREATE_TIME",
		Lineup Box( N Col( 1 ) ),
		number = Text Edit Box( CurrTime )
	),
	Panel Box( "Actions",
		H List Box(
			Button Box( "OK",
				keep_going = 1;
				BATCH_TIME = number &amp;lt;&amp;lt; Get text;
			),
			Button Box( "Cancel", keep_going = 0 )
		), 

	), 
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jan 2021 17:55:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Change-date-format-in-a-script/m-p/347756#M59869</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-12T17:55:36Z</dc:date>
    </item>
  </channel>
</rss>

