Compare datetime field with date(Fetch Duplicate request)

I have a datetime field in DB. When user selects datetime from interface, i want to make sure that date doesn't already exist in DB. Basically, i am trying to fetch duplicate requests for a day. 

I cannot use "=" operator since field is of datetime type not date and if i use other operators such as startswith, in, includes , it gives me error i.e. Cannot apply operator [INCLUDES] to field [dateTime] when comparing to value [TypedValue[it=9,v=2024-07-05 05:00:00.0]].

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer
    i want to make sure that date doesn't already exist in DB. Basically, i am trying to fetch duplicate requests for a day

    And how you are comparing?? Querying data after user enters value on interface or Comparing with already fetched data?? . If you are going with first one the both approaches suggested by Yogi would work.

    If it's second one just wrapping todate() around variable will do the work.

Reply
  • 0
    Certified Senior Developer
    i want to make sure that date doesn't already exist in DB. Basically, i am trying to fetch duplicate requests for a day

    And how you are comparing?? Querying data after user enters value on interface or Comparing with already fetched data?? . If you are going with first one the both approaches suggested by Yogi would work.

    If it's second one just wrapping todate() around variable will do the work.

Children
No Data