I need to get the last seven dates and add -4 hours to each date from my database
My SQL Query will be :
select DATEADD(hh, -4, [DateColumn])
from mydatabse.dbo.mytable
where DATEDIFF(dd, DATEADD(hh, -4, [DateColumn]), getdate()) between 1 and 7
group by DATEADD(hh, -4, [DateColumn])
Could anyone help me to convert this SQL query to LINQ ?
I suppose you're using C#? Please see if the following fits your need:
Haven't compiled it just try this
What's seems to be the problem?
DateTime
Type haveAddHours()
method so you can use it.If you want to change property in your table it will be like this: