How to add seconds to Time which is in hours:min:sec format in c#???
Example: I want to add seconds-5678 to hours:min:sec and then display the result...
You can use AddSeconds, like
DateTime.Now.AddSeconds(5678)
DateTime dt = DateTime.ParseExact("14:44:56", "HH:mm:ss", null);
string result = dt.AddSeconds(5678 ).ToString("HH:mm:ss"); // 16:19:34
Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With