linqtosql查询结果怎么取时间部分?
var date = from d in Res
where System.Data.Linq.SqlClient.SqlMethods.DateDiffDay(Convert.ToDateTime(d.St_Time), Convert.ToDateTime(rsv)) == 0
select d.St_Time;
St_Time 在SQL数据库里是Datetime格式 ,请问怎么去出 date里的所有时间部分(除去日期)。
------解决方案--------------------var date = from d in Res
where System.Data.Linq.SqlClient.SqlMethods.DateDiffDay(Convert.ToDateTime(d.St_Time), Convert.ToDateTime(rsv)) == 0
select d.St_Time.ToString("hh:mm:ss");
------解决方案--------------------var date = from d in Res
.ToList()
where System.Data.Linq.SqlClient.SqlMethods.DateDiffDay(Convert.ToDateTime(d.St_Time), Convert.ToDateTime(rsv)) == 0
select d.St_Time.ToString("hh:mm:ss");