FWIW, this is the simplest I could come up with, this is in C#
PHP Code:
timeSpan.ToString().Substring(0timeSpan.ToString().LastIndexOf("."));