In my database I have a basic table that stores, DateTime (All datestimes in UTC in SQL) and Amount.
I need to be able to do a sum (each record in the toList() sum the amount, grouped by the day in the timezone specified.) by day specifying the timezone in entityframework, but I have no idea how to do it.
Theory says if you run the query with offset -5, the actual query is something like from and to day 05:00 AM....
without timezones I would probably do it like this,
db.Payments.GroupBy(x => x.TransactionDate) .Select(g => new { TransactionDate.Date, Amount = g.Sum(x => x.Amount) });
but how would I incorporate a timezone aware sum?
https://stackoverflow.com/questions/66147400/entityframework-sum-specifying-different-timezoneoffset February 11, 2021 at 09:06AM
没有评论:
发表评论