The code below will convert the given number of days, hours, minutes and seconds into seconds.

The value used is an int, which is an alias of System.Int32. What this means is that the maximum number of seconds that can be stored is 2,147,483,647, which is the equivalent of ~68 years' worth of seconds. If a larger number is needed then the method must be changed to use a larger value type, eg long.

After I had written this method, I realised that it would be cleaner if it accepted an int array of the times, I have also implemented this below:

This change tidies up the number of parameters significantly, and works in the exact same way.