Forums

Forums / General Discussions / Convert datetime field to date

Convert datetime field to date

3 posts, 1 answered
  1. Jayson Larner
    Jayson Larner avatar
    2 posts
    Registered:
    20 Feb 2023
    20 Feb 2023
    Link to this post
    Very Very Very new to this application.  I am using TPC in SiteFinity to connect to our D365 instance.  I have a Sub-List view setup on a page and using FetchXML to pull in the data and the data is all pulling in fine.  One of my fields is a datetime field in D365 so when I display it on the page, it comes out like this:  Tue Aug 03 2021 00:00:00 GMT-0400 (Eastern Daylight Time) and I really need it to come out as 8/3/2021 instead.  How do I convert this with the template editor?  

    Again, very new so if this is a really easy question, I do apologize.  

    Thank you.
    Jayson
  2. Tom Pawelec
    Tom Pawelec avatar
    25 posts
    Registered:
    21 Oct 2022
    22 Feb 2023 in reply to Jayson Larner
    Link to this post
    Hi Jayson,

    No need to apologize. You can use this #= kendo.toString( xxxxxxxx,"dd/MM/yyyy")# on your template to format the date. Just replace the x's with your attribute name. You can also refer to this document for other formats and options.

    https://docs.telerik.com/kendo-ui/globalization/intl/dateformatting

    Regards,
    Tom
  3. Jayson Larner
    Jayson Larner avatar
    2 posts
    Registered:
    20 Feb 2023
    Answered
    22 Feb 2023 in reply to Tom Pawelec
    Link to this post
    Thank you very much for this.  I am very new to these Kendo templates and learning as I go along and have stuff that presents itself.  Oddly enough, minutes before you responded to this post, I finally tried that line of code (don't ask me why I didn't try this eons ago as it is what it is) and my page works as intended now. 

    Just goes to show how you can struggle with something so basic and once you put it out to the world that you are struggling, the answer hits you just shy of someone showing you what you were missing.  

    Thank you for your response as I greatly appreciate it.  
3 posts, 1 answered