Datetime format in column of Grid

8 posts, 0 answers
  1. Bertha
    Bertha avatar
    95 posts
    Member since:
    Aug 2012

    Posted 21 Jul 2014 Link to this post

    I am using api with json to get the date.  With the attached code, I can get the date in correct format in Grid column but the time is always 12:00.  How can I fix that.

                { field: "RequestedDate", title: "Requested Date", width: "150px", type:"datetime", template: "#= kendo.toString(kendo.parseDate(RequestedDate, 'yyyy-MM-dd'), 'dd MMM yyyy hh:mm') #" },


    Thanks.
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2894 posts

    Posted 22 Jul 2014 Link to this post

    Hi Bertha,

    What is the raw value of RequestedDate? It might be possible that the format is not recognized by kendo.parseDate.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Bertha
    Bertha avatar
    95 posts
    Member since:
    Aug 2012

    Posted 23 Jul 2014 in reply to Alexander Valchev Link to this post

    The format is from web api.  so, it is "2014-07-22T14:58:27.683".
    How can I make it work?  Thanks.
  4. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2894 posts

    Posted 25 Jul 2014 Link to this post

    Hi Bertha,

    Thank you for the additional information.

    In order to fix the issue please change the template to:
    template: "#= kendo.toString(kendo.parseDate(RequestedDate), 'dd MMM yyyy hh:mm') #"

    On a side note, the RequestedDate should be already parsed as date. It seems that in your case it is not, please check if the field is set to type: "date" in the dataSource.schema.model.fields configuration.
    Once it is set to type date the dataSource automatically parse and the template will be simplified to:
    template: "#= kendo.toString(RequestedDate, 'dd MMM yyyy hh:mm') #"

    I hope this information will help.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Bertha
    Bertha avatar
    95 posts
    Member since:
    Aug 2012

    Posted 25 Jul 2014 in reply to Alexander Valchev Link to this post

    Thanks.

    I mark it as datetime.  After I changed it to date, the time shows properly.

       RequestedDate: { nullable: false, type: "datetime" },
  6. Paolo
    Paolo avatar
    30 posts
    Member since:
    Mar 2017

    Posted 17 May 2017 Link to this post

    Hi

     

    what is the default format recognized from the kendo datetime parser for columns of type date ? in many examples I see 2014-07-22T14:58:27 ?

     

    More simply, I need to change server response format to adhere at a recognized format, where is documented the right format so I can only specify schema.model.field.type == date without needing more code ?

     

     

  7. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 19 May 2017 Link to this post

    Hi Paolo,

    The date format depends on the current culture. More information on this matter could be found in the following help article:

    Best Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  8. Paolo
    Paolo avatar
    30 posts
    Member since:
    Mar 2017

    Posted 30 Oct 2017 in reply to Konstantin Dikov Link to this post

    Thanks Konstantin, I will try
Back to Top