Converting DateTime from UTC to local

2 posts, 0 answers
  1. Steven
    Steven avatar
    11 posts
    Member since:
    Jun 2015

    Posted 22 Jan Link to this post

    I'm generating a grid using ToDataSourceResult(), and I pass an IQueryable to that. LINQ to Entities doesn't support anything like ToLocalTime(), so how can I perform that conversion?

    The property is a DateTime type in MVC, and it displays in the grid accordingly. If I specify to use a time in addition to the date, it uses the raw UTC value pulled from the DB (as expected). How can I convert it to local time, either server-side with the DataSourceResult or client-side with the grid itself or manipulating it using jQuery?

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 25 Jan Link to this post

    Hello Steven,

    Please examine the following thread that discusses how you can implement the scenario:


    Regards,
    Viktor Tachev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top