0

I have a datatable with Name and DateOfBirth column, i want to query the datatable to calculate Age using LINQ query.

  • 1
    Why not just bring back the date-of-birth as a regular column / cell, and perform the age calculation in the .net code (perhaps when rendering it); then it will be trivial. To do it in LINQ requires knowledge of which ORM you are using, as there are different ways to access inbuilt functions like `datediff` in each one – Marc Gravell Jun 18 '13 at 09:20
  • Try this http://stackoverflow.com/questions/14871056/linq-query-on-birth-date-to-get-age or this http://stackoverflow.com/questions/9/how-do-i-calculate-someones-age – kostas ch. Jun 18 '13 at 09:20
  • i used c sharp code calculation and found it too simple. thanks marc,kosta,anaximander .. – Nishant Vyas Jun 18 '13 at 09:47

1 Answers1

0
int Age = DateTime.Now.Year - BirthDate.Year
Irakli Lekishvili
  • 33,492
  • 33
  • 111
  • 169