S P

S P

  • 1.7k
  • 285
  • 154.4k

How to find earliest and latest date from list of dates?

Dec 14 2017 2:01 PM
I am adding records that have DateIn and DateOut.There can be multiple records.
 
How to find what is the earliest DateIn and the latest DateOut from that list in c# MVC?
 
 
For Example
 
Number       DateIn                      DateOut 
1                 10 Dec 2017             30 Dec 2017
2                 12 Dec 2017             31 Dec 2017
3                 5 Dec 2017               20 Dec 2017
 
SO the earlist date is 5 Dec 2017 and latest date is 31 Dec 2017 

Answers (2)