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

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -