Finding difference between two variables (HHH:MM)

I should preface by saying I have practically no background in programming, hence the struggle with what I assume will turn out to be pretty simple.

So I’m trying to find the difference between two variables in the format HHH:MM.
I am comparing a holiday time balance for an employee before and after adding an absence for testing purposes.

The problem I am having is finding the difference between the before and after balance. Due to the HHH:MM format, I can not simply .Subtract or ‘-’ the variables as they do not fit the TimeSpan or DateTime since the hours are in three digits. Furthermore, the format does not work as int32.

Thanks in advance and apologies if my question is a little messy - still getting the hang of much of the terminology.


Welcome to Forums

Check below

IF it didn’t helps you, provide few screens of your input

Mark as solution if this helps and also you can vote


Thank you, but unfortunately I didn’t find the tutorial helpful.

The exact value I’m trying to compares is 210:30, being 210 hours, 30 minutes.

Is there a way I could work around this by maybe converting it to all minutes?

Thanks again.


Check as below

Hope this helps you



This is exactly what I was looking for - thank you very much!

I was misunderstanding the C# syntax, it seems.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.