c# - How do I create a file based on the date? -


    string filename = datetime.today.tostring() + ".csv";     if(!file.exists(filename))         file.create(filename); 

i thought work throws 'format not supported' error. want csv created in directory alongside .exe

this because datetime.today.tostring() contains slashes, not valid part of windows filename.

you can, however, this: datetime.now.tostring("yyyymmdd")


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -