hi;
I have Datetime field and its stored to table like 2020-12-08 15:14:45
When I call like this
var tbl=db.Customer.First();
tbl.SENDATE = Convert.ToDateTime(tbl.SENDATE.ToString("yyyy-mm-DD")),
the result not like 2020-12-08
DataSourceResult result = data.ToDataSourceResult(request, x => new EntityModel
{
DURUMU = x.DURUMU,
DEFINITION_ = x.DEFINITION_,
TAXNR = x.TAXNR,
SENDATE = Convert.ToDateTime(x.SENDATE.ToString("yyyy-MM-dd")),
RESPONDATE = Convert.ToDateTime(Convert.ToDateTime(x.RESPONDATE).ToString("yyyy-MM-dd")),
SENDERINFO = x.SENDERINFO,
RESPONDINFO = x.RESPONDINFO,
INVAMOUNT = x.INVAMOUNT,
PRICE = x.PRICE,
APPROVER = x.APPROVER
});
return Json(result);
its showing 11.12.2020
this is shows: 2020-12-07 so good.
var test = DateTime.ParseExact(data.SENDATE.ToString("dd.MM.yyyy hh:mm:ss"), "dd.MM.yyyy hh:mm:ss",
CultureInfo.InvariantCulture).ToString("yyyy-MM-dd");
this is shows : 17.12.2020 00:00:00
DateTime test2 = Convert.ToDateTime(test);
I think the problem occur after convert. I want to escape hh:mm:ss