Date format is not working

5 posts, 1 answers
  1. hash
    hash avatar
    6 posts
    Member since:
    Jun 2011

    Posted 13 Feb 2013 Link to this post

    Hi all, 

    Here is my kendo grid declaration in the cshtml

     columns: [
                        { field: "MemberFirstName", title: "Member<br/>First Name" },
                        { field: "MemberLastName", title: "Member<br/>Last Name" },
                        { field: "ClientMemberID", title: "Client<br/>Member ID" },
                        { field: "ProviderID", title: "Provider ID" },
                        { field: "ProviderFirstName", title: "Provider<br/>First Name" },
                        { field: "ProviderLastName", title: "Provider<br/>Last Name" },
                        { field: "AppointmentDate", title: "Appointment<br/>Date" }
                     ],
    My last column is a date time column, i want to show only date value not the time. 

    I can see the data that i am binding and its clearly a date time value, When i see it in the UI, i see it as /Date(1331166600000)/

    any one had this issue before?

    I tried the following ways

    template: '#= kendo.toString(AppointmentDate,"dd MMMM yyyy") #' 
    format: "{0:dd/MMMM/yyyy}"


    None of the above two methods worked for me. 
  2. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 14 Feb 2013 Link to this post

    Hi,

     As you may know in order date to be formatted they should be a JavaScript Date instance. The DataSource will automatically convert the .NET Date literals, as the one you are using, if the field type is correctly described in the schema model definition. Therefore, please make sure you have such definition set.

    All the best,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. hash
    hash avatar
    6 posts
    Member since:
    Jun 2011

    Posted 14 Feb 2013 Link to this post

    My model is Entity framework object, do i have to define agian in the JavaScript? 

    Where can i define it in the code i mentioned in the first post.
  4. Answer
    Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 15 Feb 2013 Link to this post

    Hi,

    It appears from the snippet you have provided that you are using KendoUI Web and instantiating the Grid widget via JavaScript. In this case in order fields to be parsed to the specified type, you will need to described the Model in the schema declaration as I have already mention in my previous message. Please take a look at this online demo.

    Greetings,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Francois Dumaine
    Francois Dumaine avatar
    1 posts
    Member since:
    Aug 2005

    Posted 21 Feb 2013 Link to this post

    Rosen,

    If you good see your documentation : http://demos.kendoui.com/web/grid/local-data.html

    Go check the ASP.NET MVC. The grid sample and the code it's not the same.

    Thank you

    François Dumaine
Back to Top