Using Convert.ChangeType throws a System.InvalidCastException: Invalid cast from 'System.String' to 'System.TimeSpan'

0 Comments

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