calculate elapsed time for timecard
-
I am in a class, and need assistance to convert the HH:MM to decimal when reading from a timecard table. OneTreeUp
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.
-
I am in a class, and need assistance to convert the HH:MM to decimal when reading from a timecard table. OneTreeUp
or use
TimeSpan.Parse("2:30").TotalHours
orTimeSpan.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
-
or use
TimeSpan.Parse("2:30").TotalHours
orTimeSpan.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
Cool, I did not know that ( never had a need )
Christian Graus Driven to the arms of OSX by Vista.