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
Post a Comment