I am exporting data into a file in a Java application using NetBeans. The file will have a hard coded name given by me in the code. Please find below the code.
You can do something like that
Define your file name pattern as below :
private static final String FILE = "D:\Report_{0}.pdf";
private static final String DATE_PATTERN = "yyyy-MM-dd:HH:mm:ss";
The {0} is a marker to be replaced by the following code
private String formatFileName(Date timeStamp) {
DateFormat dateFormatter = new SimpleDateFormat(DATE_PATTERN);
String dateStr = dateFormatter.format(timeStamp);
return MessageFormat.format(FILE, dateStr);
}
For further information over date format you can see there and MessageFormat there