日期:2014-05-20  浏览次数:20614 次

路径的问题
C# code

string currentTime=System.DateTime.Now.ToString();
@"E:\Project\Screenshot\Screenshot\Image"+currentTime+".jpg"


错误提示是:不支持给定路径的格式。
求正解

------解决方案--------------------
可能当前的时间格式中有一些特殊字符,比如冒号等,不能作为文件名。可以换一些其他格式:
string currentTime=System.DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");

------解决方案--------------------

string currentTime=System.DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss");
@"E:\Project\Screenshot\Screenshot\Image"+currentTime+".jpg"