cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
Isabel26
Level III

auto fill today's date into data table name

I need to save as data table to xlsx AND auto adding today's date. For example, file name will be "old name 3/8/2022.xlsx" if I run the script on 3/8/2022, and  "old name 3/9/2022.xlsx" if I run the script on 3/9/2022. This is easy to do in SAS, and I assume JMP will be similar. Not sure how to fix the code. thanks

 

Data Table( "old name" ) << Save( "C:\old name || Today().xlsx" );

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson
Community Manager Community Manager

Re: auto fill today's date into data table name

You need to Format the date:

 

Format( Today(), "ddMonYYYY" );

 

Two things to note:

  1. You don't need Char() since Format() returns a character string.
  2. Avoid the formats that contain slashes (/) since they are used as directory delimiters.  
-Jeff

View solution in original post

4 REPLIES 4
ron_horne
Super User (Alumni)

Re: auto fill today's date into data table name

Hi @Isabel26 

perhaps this will work:

Data Table( "old name" ) << Save( "C:\old name "|| char (Today())||".xlsx" );

 

Isabel26
Level III

Re: auto fill today's date into data table name

Thanks! But the date is not format in MM/DD/YYYY. It returns 3729589915. 

Jeff_Perkinson
Community Manager Community Manager

Re: auto fill today's date into data table name

You need to Format the date:

 

Format( Today(), "ddMonYYYY" );

 

Two things to note:

  1. You don't need Char() since Format() returns a character string.
  2. Avoid the formats that contain slashes (/) since they are used as directory delimiters.  
-Jeff
Isabel26
Level III

Re: auto fill today's date into data table name

Thank you! It worked perfectly.