---
title: "DateTime.Today in mvc"  
description: "DateTime.Today in mvc"  
author: "Anonymous User"  
published: 2014-10-09  
updated: 2014-10-09  
canonical: https://www.mindstick.com/forum/2344/datetime-today-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# DateTime.Today in mvc

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to return a [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view) which will display the logs from current day.

This [sql query](https://www.mindstick.com/forum/529/rename-table-name-and-column-name-using-sql-query) does exactly what i need.

```
select * from Logs where Date>=GETDATE()-1
```

but I am [having trouble](https://answers.mindstick.com/qa/50524/how-to-fix-iphone-8-that-s-overheating-and-having-trouble-turning-on) with the [razor syntax](https://www.mindstick.com/forum/160235/what-is-razor-syntax-and-how-does-it-help-in-embedding-server-side-code-within-a-view) to write this statement in my view.\

```
return View(db.Logs.Where(a => a.Date >= DateTime.Today() - 1));
```

Any idea how to display logs in the view for the [current date](https://www.mindstick.com/forum/323/find-the-day-name-and-month-name-from-current-date)?\

## Replies

### Reply by Anonymous User

try this:

return View(db.Logs.Where(a => a.[Date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner) == DateTime.Today));


---

Original Source: https://www.mindstick.com/forum/2344/datetime-today-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
