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

gridcontrol date format

Hi,

I am working on this grid control. For displaying Datetime values, i want the datetime format to change as per the country.
Eg: India dd/mm/yyyy time: 24hr format
Us: mm/dd/yyyy time:24 hrs
So always the time is 24 hr format but the date formats are as per the country

Thanks
S


3 Replies

MC Mercy C Syncfusion Team April 18, 2012 12:05 PM UTC

Hi Smitha,

Thanks for your interest in Syncfusion products.

please make use of "QueryCellFormattedText" event to set the format and culture.

void gridControl1_QueryCellFormattedText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e)
{
if (e.Style.CellValueType == typeof(DateTime))
{
if (e.Value != null)
{
e.Text = ((DateTime)e.Value).ToString("HH:mm:ss:ff", new CultureInfo("en-In"));
e.Handled = true;
}
}
}

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

Please let me know if you have any concerns.

Regards,
Mercy.C



SM Smitha April 18, 2012 06:10 PM UTC

Thanks Mercy.




MC Mercy C Syncfusion Team April 23, 2012 12:09 PM UTC

Hi Smitha,

Thanks for your update.

Please let me know if you have any concerns.

Regards,
Mercy.C


Loader.
Live Chat Icon For mobile
Up arrow icon