Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Hi , How to Add Time Values.

Hi , How to Add Time Values.

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasetutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sneha Bisht
    wrote on last edited by
    #1

    Hi , I Have Some Time(hh,mm,ss) Values Ex. 09:00:00 , 09:25:00 , 10:30:00 Now i Have to Add these All Value And find Total No. Of Hours & Minutes & Seconds . I m using Asp.Net2.0 & Sql 2000 . How Can i Do This . Thanx.

    _ G 2 Replies Last reply
    0
    • S Sneha Bisht

      Hi , I Have Some Time(hh,mm,ss) Values Ex. 09:00:00 , 09:25:00 , 10:30:00 Now i Have to Add these All Value And find Total No. Of Hours & Minutes & Seconds . I m using Asp.Net2.0 & Sql 2000 . How Can i Do This . Thanx.

      _ Offline
      _ Offline
      _AK_
      wrote on last edited by
      #2

      I didn't get that. As you mentioned that you are having Time in hh,mm,ss format. So what is the problem in getting the hours from it. i.e. hh reprensents hours and you can simply separate it from the time given.

      Apurva Kaushal

      1 Reply Last reply
      0
      • S Sneha Bisht

        Hi , I Have Some Time(hh,mm,ss) Values Ex. 09:00:00 , 09:25:00 , 10:30:00 Now i Have to Add these All Value And find Total No. Of Hours & Minutes & Seconds . I m using Asp.Net2.0 & Sql 2000 . How Can i Do This . Thanx.

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Turn those values into TimeSpan values, representing the time span from midnight to the time given. Then you can easily add them. Use the Hours, Minutes and Seconds properties to get the result. Or add the TimeSpan to a DateTime value to make it a DateTime, which you can easily format into a string. Example:

        TimeSpan t1 = new TimeSpan(9, 0, 0);
        TimeSpan t2 = new TimeSpan(9, 25, 0);
        TimeSpan total = t1 + t2;
        string result = DateTime.Today.Add(total).ToString("HH:mm:ss"));

        Despite everything, the person most likely to be fooling you next is yourself.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups