This is a migrated thread and some comments may be shown as answers.

Column Date Formatting Not Working

3 Answers 648 Views
Grid
This is a migrated thread and some comments may be shown as answers.
King
Top achievements
Rank 1
King asked on 29 Jan 2015, 04:37 PM
I am trying to format a column containing a date that comes in as the following format: 2005-10-05T15:26:17Z.  

I am using the standard kendo ui grid column formatting syntax as follows:

$("#grid").kendoGrid({
  columns: [ {
    field: "date",
    format: "{0:yyyy-MM-dd}"
  }]

But the column is not taking the format I am giving.  It seems to ignore the format line.  Any help would be appreciated.

3 Answers, 1 is accepted

Sort by
0
Coty
Top achievements
Rank 1
answered on 30 Jan 2015, 02:58 PM
You need to supply the date type for that column in your schema so the grid knows it is a datetype.  I'm not sure where  your datasource is coming from because I don't see it in your post but here is an example using your grid:

$("#grid").kendoGrid({
dataSource: {
                                    data: myMeetings,
                                    schema: {
                                        model: {
                                            fields: {
                                                MeetingDate: { type: "date" }
                                            }
                                        }
                                    },
                                },
  columns: [ {
    field: "date",
    format: "{0:yyyy-MM-dd}"
  }]
0
Coty
Top achievements
Rank 1
answered on 30 Jan 2015, 02:59 PM
Sorry you'll want to change MeetingDate above to your column field "date"
0
King
Top achievements
Rank 1
answered on 30 Apr 2015, 01:23 PM
That was very helpful and solved my issue.  Thanks so much!
Tags
Grid
Asked by
King
Top achievements
Rank 1
Answers by
Coty
Top achievements
Rank 1
King
Top achievements
Rank 1
Share this question
or