I would like to format a column (datatype = "datetime") to display the date only. I had tried the following but not working.
headerText: "Date Received", key: "DateReceived", width: "150px", dataType: "datetime", format: "dd/MM/yyyy"
Please help.
Hello,
You need to set dataType to “date” as shown below:
{key: "Date Received", headerText: "Date Received", dataType: "date", format: "dd/MM/yyyy" }
If dataType is "date", then supported formats are following: "date", "dateLong", "dateTime", "time", "timeLong", "MM/dd/yyyy", "MMM-d, yy, h:mm:ss tt", "dddd d MMM", etc.
Refer to the link below for more details on API:
https://www.igniteui.com/help/api/2019.1/ui.iggrid
On the above link, click on the “OPTIONS” tab and expand “columns” for more details.
I hope this helps.
I have a problem with formated date in column of grid. I am using Razor syntax for the grid. Locate and region are bg, one of the column has DataType("date").Format("dateTime"), but now it isn't imposible to sort this column. Could you help me?
I had tried with the datetype = "date" and datatype = "datetime" with different format but it is still not working. Using datatype: "datetime" and format: "date", the result becomes "2006-05-29T00:00:00". Using datatype: "date" and format: "MM/dd/yyyy", the result becomes "NaN/NaN/NaN". The original datatype in the database is datetime, and I check the data is correctly serialized to JSON with "2006-05-29T00:00:00". I just need to format it to display the date only. I think it should be possible. Please help.