c# 4.0 - C# :Group XML data by date and find min Time -
i need group date , find minimum time each date. here, updatetime
xml node. application not support linq.
**updatetime** 2014-01-18t23:04:51.223542 2014-01-18t16:39:36.030992 2014-01-18t04:33:44.307508 2014-01-17t22:47:01.163672 2014-01-17t15:57:26.389259 2014-01-17t06:19:41.422436
i used enumerable collection includes sort() method
string input = "2014-01-18t23:04:51.223542 2014-01-18t16:39:36.030992 2014-01-18t04:33:44.307508 2014-01-17t22:47:01.163672 2014-01-17t15:57:26.389259 2014-01-17t06:19:41.422436"; string[] timearray = input.split(new char[] { ' ' }); list<datetime> times = new list<datetime>(); foreach (string time in timearray) { times.add(datetime.parse(time)); } times.sort((x, y) => x.compareto(y)); datetime mintime = times[0];
Comments
Post a Comment