We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Format a TimeSpan

I have ==> hh:mm:ss 
I want ==> hh:mm

I try this ==>
if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
            {
                if (e.TableCellIdentity.Column.Name == "Time")
                {
                    e.Style.Format = "hh:mm";
                }
            }

1 Reply

RD Rakesh D Syncfusion Team May 16, 2013 03:30 AM UTC

Hi Tine,

 

Thank you for using Syncfusion products.

 

Query : Format a Time Span ?

 

Based on the information provided we suspect that you are having “hh:mm:ss” in string format and want to apply formatting “hh:mm” to it. We suggest you to set the CellType of that Column to “MonthCalendar”. Please refer below code snippet for further details.

 

[aspx.cs]

 

this.GridGroupingControl1.TableDescriptor.Columns[2].Appearance.AnyRecordFieldCell.CellType = "MonthCalendar";

 

 

For your convenience we have prepared a sample for the above scenario and it is attached below. Please refer to it.

 

 

Please let us know if you have any concerns.

 

Regards,

Rakesh D

 



Format Time_59194c17.zip

Loader.
Up arrow icon