I want to format a nullable datetime value, how can I do that?
For example in Linq:
var expected1 = _context.Blogs.Select(x =>
(string)((DateTime)(x.ModifyDate ?? x.ModifyDate.Value)).ToString("yyyy-MM-dd")).ToArray();
and I tried in dynamic Linq:
var test1 = _context.Blogs.Select<string>(
"(string)((datetime)(ModifyDate ?? ModifyDate.Value)).ToString(\"yyyy-MM-dd\")").ToArray();
but I got the below error:
System.NotSupportedException : LINQ to Entities does not recognize the method 'System.String ToString(System.String)' method, and this method cannot be translated into a store expression.
any ideas?
thanks!!
I want to format a nullable datetime value, how can I do that?
For example in Linq:
and I tried in dynamic Linq:
but I got the below error:
any ideas?
thanks!!