Is it possible to split DateTime column value with FormatString as {0:MM/dd/yyyy} \Newline {0:hh:mm:ss}?
2 Answers, 1 is accepted
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Oct 2019, 01:37 PM
Hello, Zurab,
The easiest way to split the DateTime values in the grid cells is to handle the CellFormatting event and split the text as follows:
DateTime dt;
privatevoidradGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.Row is GridViewDataRowInfo && e.Column is GridViewDateTimeColumn)
{
dt = (DateTime)e.CellElement.Value;
if (dt != null)
{
e.CellElement.Text = string.Format("{0:MM/dd/yyyy}", dt) + Environment.NewLine + string.Format("{0:hh:mm:ss}", dt);
}
}
}
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.