I have Statistic
table with many fields and one of them is DateTime
. I need to find all records which are for current Year and Month. I am using query below but not sure is this optimal solution.
Statistics.Count(p => p.DateStamp.Year == DateTime.UtcNow.Year && p.DateStamp.Month == DateTime.UtcNow.Month);