file save

  • Thread starter Thread starter microsoft.news.com
  • Start date Start date
M

microsoft.news.com

I need to save a file in this format: fileName_YYYYMMdd.txt.
I forget the syntax to get the date in the file name, could some one help me
out on this one?
 
this is what i have and it keeps giving me an error:
file name or path does not exist
file is in use by another program


the file is new, it does not exist, etc.

here is my syntax
string fileName = "test_" + System.DateTime.Now.ToShortDateString() +
".doc";

now if i hard code a date in there i'm fine, or put another variable in
there i'm fine, but this syntax errors out on me
 
Hi,

It' s cause the separator , the default shoudl be / or maybe \ just use
ToString("yyMMdd")

Note theck the DAteTime.ToString method to see if the format is the correct
one or to see other formats available


cheers,
 
Back
Top