Click here to Skip to main content
12,622,652 members (28,701 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
I got this select

var qDuration = from rowU in DataAccess.metadata.um_User
                                join rowLC in DataAccess.metadata.um_CallLog
                                on rowU.userID equals rowLC.userID
                                group rowLC by new { userID = rowLC.userID } into groupN
                                select new
                                {
                                    userID = groupN.Key.userID,
                                    noOfCalls = groupN.Count(),
 
                                    totDurationSec = (from row in groupN
                                                      select row.Duration.Seconds).Sum(),
                                    totDurationMin = (from row in groupN
                                                      select row.Duration.Minutes).Sum(),
                                    totDurationHours = (from row in groupN
                                                      select row.Duration.Hours).Sum(),
                                    
                                };
now I wanna populate my time span with sums I did in this select

var qTime = new TimeSpan(1, 0, 0);
             string Dislay = qTime.ToString()
Posted 20-Feb-13 1:48am
kolisa580
Updated 20-Feb-13 2:03am
Joezer BH38.7K
v2
Comments
Sandeep Mewara 20-Feb-13 9:17am
   
And... the issue is?
kolisa 20-Feb-13 10:04am
   
i have separated by min,hr,sec sum ,how can i combine those to get 0:00:00 in timespan

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If you have separated the hours, minutes and seconds, just call:

<pre lang="cs">var qTime = new TimeSpan(HOURS, MINUTES, SECONDS);
                string Dislay = qTime.ToString()
  Permalink  
Comments
kolisa 21-Feb-13 1:56am
   
my problem I can access the,totDurationSec cos they are inside a select and I cant make them global

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100