+ 1

Get Date Only From DateTime In C#

Hello Friends, In my table I have field Meter_Date with datatype date. My DataTable I have field Meter_Date with datatype datetime because there is no date datatype available in datatable. When I write query Select Meter_Date from Profile_Data and fill the table and run the report it gives me date+time for example 2017-12-17 12:00:00 AM I just need Date. I do some think like Select Convert(DATE, Meter_Date) but this gives me " " -> nothing. Please help.

17th Dec 2017, 11:59 AM
Salman Mushtaq
Salman Mushtaq - avatar
1 Answer
0
CONVERT(data_type(length), expression, style) You are missing the style property. Select Convert(DATE, Meter_Date, 101) Would give you 12/17/2017 https://www.w3schools.com/sql/func_sqlserver_convert.asp
17th Dec 2017, 5:39 PM
sneeze
sneeze - avatar