Friday, 9 August 2013

adding date in file name itself while creating the file name

adding date in file name itself while creating the file name

I have to create a file name like this
aaabbb.dat
so I have choose this format ..
String finalfilename= "aaabbb" +".dat";
now I have to add few things more in the file name like business date for
which the file is generated and creation date that is the date and time
file was created ..such as
2013-06-05_2013_06_05_193000.dat
so I have come up with different methods like..
private String getBusinessDate() {
return new SimpleDateFormat("yyyyMMdd").format(new Date());
}
private String getFileDate() {
return new SimpleDateFormat("yyyyMMdd HH:mm").format(new Date());
}
now please advise how can I add this in file name process itself as I have
to be very careful while adding this to have final file name like this..
so please advise what need to be added in file constructor
file f = new file(// what need to be added here..?)

No comments:

Post a Comment