how to write a filename
here is my problem I want my Log Files Filename to be created with respect to the Current Date..e.g. say today is May 24,2007....then the created log file will display in c;/ as c:/2007-05-24.csv....then if I'll use the application say in June 05..another file will be created c:/2007-06-05.
BufferedWriter out = new BufferedWriter(new FileWriter("c:/Filename.csv", true));
out.write(" AutoArchive-Process Started at ");
Calendar c = new GregorianCalendar();
out.write(c.getTime().toString());
out.close();
[558 byte] By [
ryshi1264a] at [2007-11-27 5:20:02]

You can do this:
SimpleDateFormat bartDateFormat =
new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String dateValue=(bartDateFormat.format(date));
String fileName="C:\\"+dateValue+".csv";
BufferedWriter out = new BufferedWriter(new FileWriter(fileName, true));
Sorry didn't see the previous post
Message was edited by:
diptaPB
I encountered an error in this part upon compilation
Date date = new Date();
nit:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Administrator\Archive\build\classes
C:\Documents and Settings\Administrator\Archive\src\ArchLog.java:176: cannot find symbol
symbol : constructor Date()
location: class java.sql.Date
Date date = new Date();
thank you so much ..got it....one more question though how will i display the contents of this file and file directory in a jTestArea or JTable...let's say it will display the content of "c:/AutoArchive2007-05-24.csv" in a jTextarea or jTable....
-
user:jeffAutoArchive-Process Started at Thu May 24 15:41:54 GMT+08:00 2007
and ended at Thu May 24 15:41:54 GMT+08:00 2007
--