SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an issue again...

I create list from csvfile. I convert string with date into DateTime type like this:

 string[] formattedDates = { "dd.MM.yyyy HH:mm:ss", "mm:ss", "HH:mm:ss", "dd.MM.yyyy", "HH:mm:ss" };

 newEntry["Duration"] = DateTime.ParseExact("00:05", formattedDates, CultureInfo.InvariantCulture, DateTimeStyles.None);

but when i check my list of data - duration time (ex: 01:44, 00:05) converts and shows up like this 8/27/2012 00:05 (but it is not Time it is only duration time)

So the questions are:

  1. How make it show up in the list in suitable format (without date = "00:05")?

  2. Will minutes 00:05, 00:41, 01:03 sum as 01:49 - total duration?

  3. If 2. is not possible, can you offer your solution?

share|improve this question
up vote 0 down vote accepted

Many thanks to Marc D Anderson( [link] (

  1. call template

    <td class="ms-vh" nowrap="nowrap">                                              
    <xsl:variable name ="NodesTotals">                             
     <xsl:call-template name="TotalValue">
         <xsl:with-param name="Node" select="$nodeset"/>
        sum : <xsl:value-of select="$NodesTotals" />

  2. Sum rows

      <xsl:template name="TotalValue">
        <xsl:param name="Node"/>     
        <xsl:param  name="Sum" select="0"/>      
          <xsl:when test="$Node">
             <xsl:variable name="desimal">
                <xsl:value-of select="substring-before(ddwrt:FormatDateTime(string($Node[1]/@Duration),1033,'HH:mm'),':')*60 + substring-after(ddwrt:FormatDateTime(string($Node[1]/@Duration),1033,'HH:mm'),':')"/>
             <xsl:call-template name="TotalValue">
                <xsl:with-param name="Node" select="$Node[position()!=1]"/>
                <xsl:with-param name="Sum" select="$Sum + $desimal"/>
          <xsl:otherwise><xsl:value-of select="$Sum"/></xsl:otherwise>    

Thank you!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.