2

My kendo grid is showing date like this /Date(691869600000)/ . How do i solve this?

OnaBai
  • 40,767
  • 6
  • 96
  • 125
Ehtesam
  • 31
  • 2
  • 4

5 Answers5

7

Using this answer I got the Steve code to work for my case. Try this template:

"#= kendo.toString(new Date(parseInt(myField.substr(6))),'MM/dd/yyyy HH:mm tt')#"
Community
  • 1
  • 1
maiconmm
  • 311
  • 4
  • 16
2
'#= kendo.toString(yourDateField,"MM/dd/yyyy HH:MM tt")#'

and make your field type as date.

Taryn
  • 242,637
  • 56
  • 362
  • 405
steve
  • 664
  • 4
  • 16
  • 42
1

You need to specify the date as a type in your datasource definition - else it will just be a string:

For example if your field is birthday:

var kendoDS = new kendo.data.DataSource({
schema: { 
 model: {
 fields: {
  birthday: { type: "date"}
 }
 }           
});

And when you define the Grid:

kendoGrid({
 selectable: whatever values..etc
 columns: your-response,
 dataSource: kendoDS 
});

See this for more info: http://www.kendoui.com/forums/framework/data-source/json-date-handling-changed-in-latest-release.aspx

Carl
  • 1,266
  • 10
  • 20
0

Use template like the following or like the one in the documentation link.

#= kendo.format("{0:d}",theDateTimeFieldName)#
Petur Subev
  • 19,983
  • 3
  • 52
  • 68
0

var offsetMiliseconds = new Date().getTimezoneOffset() * 60000;

    #= kendo.toString(new Date( parseInt(JSONDateTime.substr(6)) + offsetMiliseconds),"dd-MMM-yyyy hh:mm tt") #
Nightflame
  • 21
  • 1