2

I get a date (the value parameter shown below) from SQL that looks like this: "2014-08-22T07:45:13.12Z". I want to format it so that I see this in the grid: "08/22/2014". I have tried this in the schema for the data source:

ModifiedDate: {
                  editable: false,
                  type: "date",
                  parse: function (value) {
                        var dt = kendo.parseDate(value, "yyyy/MM/dd");
                        return dt.getMonth() + "/" + dt.getDate() + "/" + dt.getFullYear();
                  }
               }

but get a null value for dt on the parseDate. What am I doing wrong?

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
Scott
  • 2,456
  • 3
  • 32
  • 54

2 Answers2

0

I did this instead to fix the problem.

        ModifiedDate: {
            editable: false,
            type: "date",
            parse: function (value) {
                var dt = new Date(value);
                return (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
            }
        }
Scott
  • 2,456
  • 3
  • 32
  • 54
0

you can do like below in your grid option:

{ field: "buyTime", title: "buyTime", format:"{0:yyyy-MM-dd}", width: "120px" },
David Arenburg
  • 91,361
  • 17
  • 137
  • 196
sendreams
  • 389
  • 2
  • 13