Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo UI Grid Format Date column

I am trying to show a datetime column appropriately in my Kendo UI Grid. Date is being shown successfully, but not time. Here's a simple jsfiddle showing my scenario.

field: "Date",
title: "Date",
format: "{0:dd-MMM-yyyy hh:mm:ss tt}",
parseFormats: ["MM/dd/yyyy h:mm:ss"]

I have tried different alternatives with no success. Any thoughts on how to show the content as expected would be greatly appreciated!

like image 424
Gonzalo Avatar asked Sep 06 '25 03:09

Gonzalo


2 Answers

Use template:

 {
    field: "Date"
    , title: "Date"
    , width: "100px"
    , template: "#=  (Date == null)? '' : kendo.toString(kendo.parseDate(Date, 'yyyy-MM-dd'), 'MM/dd/yy') #"
 },
like image 104
freedeveloper Avatar answered Sep 07 '25 21:09

freedeveloper


datatype you specified for date field is date type.it should be datetime as shown in the below

fields: {
    Id: { type: 'number' },
    FirstName: { type: 'string' },
    LastName : { type: 'string' },
    Date: { type: 'datetime' }
}
like image 39
fatih kiymet Avatar answered Sep 07 '25 20:09

fatih kiymet