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. General Programming
  3. C#
  4. calculate elapsed time for timecard

calculate elapsed time for timecard

Scheduled Pinned Locked Moved C#
4 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.
  • O Offline
    O Offline
    onetreeup
    wrote on last edited by
    #1

    I am in a class, and need assistance to convert the HH:MM to decimal when reading from a timecard table. OneTreeUp

    C L 2 Replies Last reply
    0
    • O onetreeup

      I am in a class, and need assistance to convert the HH:MM to decimal when reading from a timecard table. OneTreeUp

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Use string.Split to get two numbers, then int.TryParse to convert to ints, then cast those to double when doing the division to get a decimal.

      Christian Graus Driven to the arms of OSX by Vista.

      1 Reply Last reply
      0
      • O onetreeup

        I am in a class, and need assistance to convert the HH:MM to decimal when reading from a timecard table. OneTreeUp

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        or use TimeSpan.Parse("2:30").TotalHours or TimeSpan.Parse("2:30").TotalMinutes to get a real number representing the amount of time in the unit of your choice. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


        C 1 Reply Last reply
        0
        • L Luc Pattyn

          or use TimeSpan.Parse("2:30").TotalHours or TimeSpan.Parse("2:30").TotalMinutes to get a real number representing the amount of time in the unit of your choice. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Cool, I did not know that ( never had a need )

          Christian Graus Driven to the arms of OSX by Vista.

          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