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

Problem formatting date value in grid


I have a grid:
@Html.EJS().Grid("grdBeneficiarios").DataSource(dataManager => { dataManager.Json(Model.ToArray()).InsertUrl("/Contrato/AgregarBeneficiario").RemoveUrl("/Contrato/EliminarBeneficiario").UpdateUrl("/Contrato/ActualizarBeneficiario").Adaptor("RemoteSaveAdaptor");}).ActionBegin("actionBegin").Columns(col =>
    col.Field("IdTiposIdentificacion").HeaderText("Tipo id").ForeignKeyField("IdTiposIdentificacion").ForeignKeyValue("Nombre").DataSource((List<TipoIdViewModel>)PersonaServices.GetTiposId()).Add();
    col.Field("NumeroId").HeaderText("Numero id").Add();
    col.Field("PrimerNombre").HeaderText("Primer nombre").Visible(false).Add();
    col.Field("SegundoNombre").HeaderText("Segundo nombre").Visible(false).Add();
    col.Field("PrimerApellido").HeaderText("Primer apellido").Visible(false).Add();
    col.Field("SegundoApellido").HeaderText("Segundo apellido").Visible(false).Add();
    col.Field("IdSede").HeaderText("Sede").ForeignKeyField("IdSede").ForeignKeyValue("Nombre").DataSource((List<SedeViewModel>)ContratoServices.GetSedes().FindAll(s => s.Habilitado)).Add();
    col.Field("WelcomeDay").HeaderText("Welcome day").Format("MM/dd/yyyy hh:mm").EditType("datetimepickeredit").Add();
    col.HeaderText("Enviar email").Width("160").Commands(comandos).Add();
}).Locale("es-CO").DataBound("dataBind").Load("load").EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog); }).Toolbar(toolbarItems).Render()

But no data is displayed, except when I delete the .Format option for the "WelcomeDay" column. The problem is that the value showed is: 
Fri Mar 22 2019 09:00:00 GMT-0500 (hora estándar de Colombia)
is too long!.

9 Replies

MS Madhu Sudhanan P Syncfusion Team March 25, 2019 12:55 AM

Hi Juan, 

Thanks for contacting Syncfusion support. 

You need to format the date value as follows with your own format value. 

col.Field("WelcomeDay").HeaderText("Welcome day").Format(new { type = "dateTime", format="MM/dd/yyyy hh:mm"}) 

Please refer to the below documentation link. 

Madhu Sudhanan P 

JJ Juan José March 25, 2019 06:11 PM


Thanks so much. Now it is working but, now I have the same problem with the grid using Javascript.
My code is like the sample in documentation in https://ej2.syncfusion.com/javascript/documentation/grid/columns/#date-formatting :

columns: [
                    { field: "IdBeneficiario", isPrimaryKey: true, isIdentity: true, visible: false },
                    { field: "NumeroId", headerText: "Numero id" },
                    { field: "PrimerNombre", headerText: "Primer nombre", visible: false },
                    { field: "SegundoNombre", headerText: "Segundo nombre", visible: false },
                    { field: "Email", headerText: "Email" },
                    { field: "WelcomeDay", headerText: "Welcome day", format:{ type:"dateTime", format:"yyyy/MM/dd hh:mm a" }, editType: "datetimepickeredit"},

With the format included, no rows are shown but, if I delete the format, all rows are shown
I don´t know what is wrong, I am writting in the same way as the sample in documentation.

Thanks for your help,
Kind regards,

PS Pavithra Subramaniyam Syncfusion Team March 26, 2019 04:07 AM

Hi Juan, 

Thanks for your Update. 

We have analyzed your query but we are unable to reproduce the reported issue at our end. So please provide the below information for us, it will help us provide a better solution as soon as possible, 

  1. Please share the Sample data of your Grid.
  2. Please share you full grid code sample?
  3. Please share grid package version details?
  4. Could you please try to reproduce the reported issue in the below provided sample?
  5. Please try to bind ‘actionFailure’ event in Grid and share the argument of that event

Please get back to us for further assistance. 
Pavithra S. 

JJ Juan José April 6, 2019 11:46 AM


I am still facing this issue with javascript.

I am attaching the info requested:
DataSource.PNG shows the data used to feed the grid.
actionFailure.PNG shows the action failure args.
GridCode.txt has the whole grid code.

Thanks for your help, kind regards

Juan J.

Attachment: FormatDate_d6193346.zip

HJ Hariharan J V Syncfusion Team April 8, 2019 06:08 AM

Hi Juan, 

Thanks for the provided details. 

From your screenshot, we found that date column value is in JSON string format. But it is necessary to provide the JSON data to JsonAdaptor instead of this JSON string. So we suggest to parse this JSON string to JSON data before providing it to Grid. Please refer the following code snippet, 

var data = new ej.data.DataManager(window.orderData).executeLocal(new ej.data.Query().take(15)); 
    var grid = new ej.grids.Grid({ 
        dataSource: ej.data.DataUtil.parse.parseJson(data), 


JJ Juan José April 8, 2019 08:29 AM

Thanks so much, it is woring now.
Kind regards,
Juan J.

HJ Hariharan J V Syncfusion Team April 9, 2019 12:57 AM

Hi Juan, 
Thanks for your update.  
We are happy to hear that the provided solution helped you.   
Please contact us if you need any further assistance. As always, we will be happy to assist you.   

BR Bernadus Rangga Kresna Waskita July 28, 2022 10:43 PM

nice this is just what I needed too, convert it to json (^_^)

RR Rajapandi Ravi Syncfusion Team July 31, 2022 11:30 PM

Hi Bernadus,

We are happy to hear that our provided suggestion was helpful.

Please get back to us if you need further assistance.


Rajapandi R

Live Chat Icon For mobile
Up arrow icon