为什么我收到此错误消息? [英] Why am I getting this error message?
本文介绍了为什么我收到此错误消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我执行时,我收到此错误消息。
DateTime date = DateTime.Parse(sdate);
String is不是有效的DateTime
When I execute, I get this error message.
DateTime date = DateTime.Parse(sdate);
"String is not a valid DateTime"
public ActionResult DownloadFile(string sdate)
{
string filecontent = string.Empty;
//changed iFTDTLContext to IFTDTLEntities
using (var context = new Models.AFMESEntitiesContext())
{
DateTime date = DateTime.Parse(sdate);
//changed Admits to Files
//changed file to files
var results = (from f in context.BlindResults
where f.ExtractDate.Value.Year == date.Year && f.ExtractDate.Value.Month == date.Month && f.ExtractDate.Value.Day == date.Day
select f).ToList();
filecontent = CreateDelimitedData(results);
}
我尝试过:
我尝试更改格式但仍然收到消息。任何人都可以帮忙吗?
What I have tried:
I tried changing the format but still get the message. Can anyone help?
推荐答案
没有看到 sdate 包含的内容,很难分辨。
是吗有效的DateTime?如果是这样,它的格式是什么?
你真的应该查看各种 DateTime Methods [ ^ ]
Without seeing what sdate contains, it is hard to tell.
Is it a valid DateTime? If so, what format is it in?
You really should review the documentation for the various DateTime Methods[^]
这篇关于为什么我收到此错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文