Trying to add the date & time to an outfile name

Why doesn't this work when I write out a file?

outputFile = "r:\\event_capture\\WI_Madison_Monona\\" + "event_details_"+session.logCurrentDateAndTime()+".txt";

Instead of the date/time it appends "void".

Thanks.

The "session.log" is a method

The "session.log" is a method only for the screen-scraper log, and will not create a string for you to use. Instead make a function like:

String getDateTime()
{
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HHmmss");
Date date = new Date();
return dateFormat.format(date);
}

And edit the string to use the function.

outputFile = "r:/event_capture/WI_Madison_Monona/" + "event_details_" + getDateTime() + ".txt";

For that script to work, you

For that script to work, you should also import some things at the top of the script:

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;