How to Subtract Dates in LINQ?

Posted by Gopesh9 under C# on 8/28/2012 | Points: 10 | Views : 3199 | Status : [Member] | Replies : 1
Hi Friends...

I had came across a query, where i have to find the FirstName, LastName, Age from Employee table who are managers and their age is above 30.

Now in my Employee table, i have the columns--
EmployeeID(int)
FirstName(string?)
LastName(string?)
BirthDate(DateTime?)
HireDate(DateTime?)

Now i want help to write the query to get the years after subtracting BirthDate from the current date..

Thanks

G. S.
.Net Developer



Responses

Posted by: Vuyiswamb on: 8/28/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Someone asked about this before, so if you dont know Linq , there is a Tool that can allow you to write SQL statements and Convert it to Linq

http://www.dotnetfunda.com/forums/thread6833-tool-to-convert-sql-query-to-linq-query.aspx

Thank you for posting at Dotnetfunda
[Administrator]

Gopesh9, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response