Select max and Min DateTime of a column in DataTable

To Select the Max and Min you can use this code.

DateTime StartTime = Convert.ToDateTime((dt.Compute("min(StartDate)", string.Empty)));

DateTime EndTime = Convert.ToDateTime((dt.Compute("max(EndDate)", string.Empty)));

Happy Coding


Author: nRk17 Sep 2009 Member Level: Silver   Points : 0


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: