DATE and DATETIME column problem

2 posts, 0 answers
  1. Jan
    Jan avatar
    3 posts
    Member since:
    May 2015

    Posted 08 Aug 2018 Link to this post

    Hi,

    I adds a DATE column (created date of the record) into KendoUI grid, but the database format of column is DATETIME, because, I need to know also time. Problem is, when Im using filtering functionality, because when I would like to filter this column to date = for example 2018-08-08 and Im sure, that some records was created on this day, datagrid do not fond nothing. Its because, the datagrid is searching for 2018-08-08 00:00:00 and no record exists with a zero time.

     

    Is there any way to solve this problem in datagrid or, there is needed to create two columns in the database, one as a DATETIME and second as a DATE. I have problem also with the WEEK number (I opened another discussion thread). If I need to add also the week number, I need to have 3 columns in the database for one information: DATETIME, DATE, WEEK. I think, its poor solution. Do you have any other ideas?

     

    Thanks for help.

  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 09 Aug 2018 Link to this post

    Hello Jan,

    Depending on whether your Grid can use client-side filtering, there are alternative solutions to this problem. The main two are described in this help article:
    Filter by Date Only

    The first will work only if the Grid DataSource uses client-side filtering. If not, you could try the second listed solution—to use two filter expressions (greater than beginning of day and less than end of day) instead of a single one (equal to beginning of day) when the user selects the equals filter.

    Regards,
    Tsvetina
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top