Unique Date Formatting Issue

2 posts, 0 answers
  1. Tim
    Tim avatar
    10 posts
    Member since:
    May 2014

    Posted 11 Sep 2014 Link to this post

    I wish I could get as far as all the other users having issues with formatting dates, but I'm stuck right here. The Format method isn't working. My grid is still displaying a Json date looking like this /Date(1364927400000)/. My date field is actually a DateTimeOffset field and I really would rather use a format string like yyyy-MM-dd hh:mm:ss tt K or yyyy-MM-dd hh:mm:ss tt zzz, but /Date(1364927400000)/ is completely unacceptable.


    ​ @(Html.Kendo().Grid<UtiliPoleOfficeWeb.Models.JobPriorityModel>()
    .Name("grid")
    .Columns(columns =>
    {
    columns.Bound(p => p.Id).Hidden(true);
    columns.Bound(p => p.Description).Width(150);
    columns.Bound(p => p.Priority).Width(100);
    columns.Bound(p => p.Owner).Width(100);
    columns.Bound(p => p.Started).Format("{0:dd/MM/yyyy}");
    columns.Bound(p => p.Inspector).Width(150);
    columns.Bound(p => p.Completed).Width(425).Format("{0:dd/MM/yyyy}");
    columns.Bound(p => p.FRInspector).Width(140).Title("Field Review Inspector");
    columns.Bound(p => p.FRCompleted).Width(425).Title("Field Review Completed");
    columns.Command(command => { command.Edit(); }).Width(100);
    }) . . .

    Please help.

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2596 posts

    Posted 15 Sep 2014 Link to this post

    Hi Timothy,

    The problem is caused by the fact that the dates that you pass to the grid are not actually of type date. I would suggest you to check the following forum thread, where an issue similar to yours is discussed, please check it out and if you have any questions, please do not hesitate to contact us:

    http://www.telerik.com/forums/format-json-date-in-grid

    Regards,
    Kiril Nikolov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top