Hi, I have a grid with a nullable TimeSpan column. When exporting to Excel the format shows as 09:02:39. I'd like it just to be 09:02. In OnExcelBeforeExport I have args.Columns.NumberFormat = BuiltInNumberFormats.GetHourMinuteAMPM(); but it has no effect. Should it?
1 Answer, 1 is accepted
answered on 14 Mar 2023, 01:56 PM
The GetHourMinuteAMPM() works with DateTime objects. It generates format with hours, minutes and AM/PM that indicates the specific part of the day.
The TimeSpan is generally used to indicate duration or difference between DateTime objects. It represents a time period and not a specific time of the day. Thus, the GetHourMinuteAMPM() built-in format is not applicable to it.
I hope you will find the above information useful. Please let us know if any other questions appear.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.