user1108069 user1108069 - 5 months ago 29
C# Question

how to convert 24-hour format TimeSpan to 12-hour format TimeSpan?

I have TimeSpan data represented as 24-hour format, such as 14:00:00, I wanna convert it to 12-hour format, 2:00 PM, I googled and found something related in stackoverflow and msdn, but didn't solve this problem, can anyone help me? Thanks in advance.

Seems that it's possible to convert 24-hour format TimeSpan to String, but impossible to convert the string to 12-hour format TimeSpan :(

But I still got SO MANY good answers, thanks!


TimeSpan represents a time interval not a time of day. The DateTime structure is more likely what you're looking for.