I have the input 15:20:30
I want to convert to seconds.
Seeing as though you haven't specified the question properly I have interpreted it to represent 15 hours 20 minutes and 30 seconds, as opposed to DateTime.Now. (Obviously this is the same as "How many seconds since midnight")
TimeSpan MySpan = new TimeSpan(15, 20, 30);
MySpan.TotalSeconds;
Although if you're only wanting the Seconds from the current DateTime.Now (this is not the TotalSeconds, just the current minutes seconds), just use:
DateTime.Now.Second
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