Created
April 19, 2018 10:57
-
-
Save ChadRoberts21/c7994ada0b3359191958a5375741c59f to your computer and use it in GitHub Desktop.
Get Last 24h of data (LINQ)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// query= a Query object containing a search string | |
DateTime searchTime; | |
if (DateTime.TryParse(query.Search, out searchTime)) | |
{ | |
DateTime endTime = searchTime + new TimeSpan(24, 0, 0); | |
IQueryable linq = dbContext.DataTable | |
.Where(x => x.TimeStamp >= searchTime) | |
.Where(x => x.TimeStamp <= endTime); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment