Time Stamp in Name of the CSV OutputFile
Hello Support:
I'm trying to include the date in the name of the csv output file. I added this to the top of my script:
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
String getDateTime()
{
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-d HH:mm:ss");
Date date = new Date();
return dateFormat.format(date);
}
import java.text.DateFormat;
import java.text.SimpleDateFormat;
String getDateTime()
{
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-d HH:mm:ss");
Date date = new Date();
return dateFormat.format(date);
}
Then on the outputfile I wrote the date as follows:
outputFile = "C:/Documents and Settings/Me/Desktop/XXX Search/outwrite( getDateTime()).csv";
However, the name of my output file was "outwrite(getDateTime())". I tried a variation of the above with "session.getVariable(getDateTime())" but it had the same effect.
Thanks in advance for your help.
Should be:outputFile =
Should be:
Colons don't work well in file names, so you may want to remove those from the time.