get date part only from datetime value using entity framework

前端 未结 3 1699
时光取名叫无心
时光取名叫无心 2020-12-03 18:00

I want to get date part only from database \'date time\' value I m using the below code..but it is getting date and time part.

using (FEntities context = new         


        
3条回答
  •  失恋的感觉
    2020-12-03 18:21

    context.Database.SqlQuery(sql, sql_parameters)
    

    accepts pure SQL in the first parameter. Use MS SQL server's function CONVERT(VARCHAR(6), date_value, 112) AS MonthYYYYmm for retrieving year with month.

提交回复
热议问题