Hi @Joe ,
You can use the Enumerable.Select method to project each element of the sequence into a new form.
For details, you can check the documentation.https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.select?view=net-6.0
You could also try parsing locally instead of in the database via AsEnumerable.
var query = db.tb1.Select(tb => tb.dt)
.AsEnumerable() // Do the rest of the processing locally
.Select(x => DateTime.ParseExact(x, "ddMMyyyy",
CultureInfo.InvariantCulture));
If you just want to show it on the view/UI, you can use this:
@model.DateCreated.ToString("dd / MM / yyyy")
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.