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?
 
You'll need to use the System.DateTime class. Usage should be fairly
obvious.
 
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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top