When you use the function Convert.ChangeType on a TimeSpan, you will get a System.InvalidCastException: Invalid cast from ‘System.String’ to ‘System.TimeSpan’. Use TimeSpan.FromDays
TimeSpan.FromHours
TimeSpan.FromMilliseconds
TimeSpan.FromMinutes
TimeSpan.FromSeconds
TimeSpan.FromTicks

or the TimeSpan.TryParse method to convert a string to a TimeSpan.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.