Reputation: 4464
working hours of a person in my program will be shown like this:
As they are in string format how can I calculate the total hours of a person?
Upvotes: 0
Views: 112
Reputation: 10201
You indeed need to store the values as TimeSpan instances.
But maybe they are given to you as strings. In that case you can convert them to TimeSpan using TimeSpan.Parse(), see http://msdn.microsoft.com/en-us/library/system.timespan.parse.aspx
Upvotes: 0
Reputation: 46008
You need to store the values as TimeSpans
, so you can perform calculations on them, and only convert to strings for display purposes.
Upvotes: 1