C# Programming
08-27-2009, 07:08 PM
I am very new to C#, and i just want to create a .txt file with the current date and time as the filename.
Here is the code i've put together from bits and pieces on the net, and it isnt working
string date = DateTime.Now.ToString("yyyyMMdd_hhmmss");
TextWriter tw = new StreamWriter("{0}.txt", date);
I have also tried
TextWriter tw = new StreamWriter(DateTime.Now.ToString("yyyyMMdd_hhmmss.txt"));
It creates the filename i want, but with the .pxp extension instead of the .txt
Any help would be greatly appreciated http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif
modified on Thursday, August 27, 2009 10:24 AM
Here is the code i've put together from bits and pieces on the net, and it isnt working
string date = DateTime.Now.ToString("yyyyMMdd_hhmmss");
TextWriter tw = new StreamWriter("{0}.txt", date);
I have also tried
TextWriter tw = new StreamWriter(DateTime.Now.ToString("yyyyMMdd_hhmmss.txt"));
It creates the filename i want, but with the .pxp extension instead of the .txt
Any help would be greatly appreciated http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif
modified on Thursday, August 27, 2009 10:24 AM