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

convert datatime am,pm format to 24hr

Hi,
I am using a grid control in windows forms.
There my data has a datetime format. am.pm.
But while displaying on the grid, i want to convert it to a 24hr format.
What events should i use

Smitha


1 Reply

MC Mercy C Syncfusion Team April 18, 2012 11:11 AM UTC

Hi smitha,

Thanks for your interest in Syncfusion products.

To set 24-hours date time format, please make use of the following code.

this.gridControl1.ColStyles[this.gridControl1.ColCount].CellValueType = typeof(DateTime);
this.gridControl1.ColStyles[this.gridControl1.ColCount].CellValue = DateTime.Now;
this.gridControl1.ColStyles[this.gridControl1.ColCount].Format = "HH:mm:ss:ff";

Please refer to the sample in the following link
http://www.syncfusion.com/downloads/Support/DirectTrac/92112/WindowsFormsApplication8519649990.zip

Please let me know if you have any concerns.

Regards,
Mercy.C


Loader.
Live Chat Icon For mobile
Up arrow icon