0

I save the date in the database as utc.

Code:

var result = _context.Tables
                     .OrderBy(x => x.UTCDate.ToLocalTime())
                     .ToList();
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
beta
  • 1
  • 1

1 Answers1

1

Entity framework needs to translate your query into SQL

It cannot translate a c# function to SQL That is why you cannot use that

See here Linq-to-EF DateTime.ToLocalTime not supported

David Edel
  • 569
  • 4
  • 18