Search code examples
c#sql-serverdapper

Dapper updates returned datetime format


I have tried to find similar question, but failed, so will create new question.

  1. This is what stored on Db:

    database result

  2. This is what gets returned:

    enter image description here

Is there a way to disable any formatting?

Or some explicit mapping should be done, etc.?


Solution

  • @robert-mckee gave you the answer in the comments: the way you bring the results back for result1 is the cleanest way. If you return data as a DateTime object you are free to format it any way you want in your view after mapping.