如果把从页面控件输入的日期,转换成日期型数据并进行数据查询

vainwords 2005-03-08 02:50:14
我用
start_date = "";
convert.todatetime(start_date); 怎么总是报错呀
...全文
94 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
net_boy 2005-03-08
  • 打赏
  • 举报
回复
string start = start_year.SelectedValue + "-" + start_month.SelectedValue + "-" + start_day.SelectedValue;
string end = end_year.SelectedValue+"-"+end_month.SelectedValue+"-"+end_day.SelectedValue;
DateTime start_date = new DateTime();
start_date = Convert.ToDateTime(start.ToString());
DateTime end_date = new DateTime();
end_date = Convert.ToDateTime(end.ToString());
string start_string = start_date.ToShortDateString();
string end_string = end_date.ToShortDateString();
xueqs 2005-03-08
  • 打赏
  • 举报
回复
start_date不可以为空
china2001ok 2005-03-08
  • 打赏
  • 举报
回复
不是还有小时 和分秒吗?
vainwords 2005-03-08
  • 打赏
  • 举报
回复
string start = start_year.SelectedValue + "-" + start_month.SelectedValue + "-" + start_day.SelectedValue;
string end = end_year.SelectedValue+"-"+end_month.SelectedValue+"-"+end_day.SelectedValue;
DateTime start_date = new DateTime();
start_date = Convert.ToDateTime(start.ToString());
DateTime end_date = new DateTime();
end_date = Convert.ToDateTime(end.ToString());
nycun 2005-03-08
  • 打赏
  • 举报
回复
start_date不可以为空呢。

还有大小写哦

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧