How to ignore time from datetimefield while comparing with date field?

How to ignore time from datetimefield while comparing with date field?

  

Hi,

I have an attribute called UpdatedOn and it's data type is DateTime but while comparing I want to compare with today's date and fetch me today's records but it's not working. How do I achieve this? I am just passing date input and want today's records but datetime is not allowing that comparison.

Thanks and Regards,

Suraj Borade

Hi Suraj,

You can convert your date time to date and then compare to current date

DateTimeToDate(EntityTest.DateTime) = CurrDate()

Or get datetime that are bigger than today at 00:00:00 and previous to tomorrow at "00:00:00":

EntityTest.DateTime >= BuildDateTime(CurrDate(), #00\:00\:00#) and EntityTest.DateTime < BuildDateTime(AddDays(CurrDate(), 1), #00\:00\:00#)

Best regards,

João Nobre

Solution

Hi Joao,

Thanks for the reply.

I needed this functionality in advance query in where clause to compare date passed with datetime column.

I used Convert() function in advance SQL and it solved the problem.

Thanks,

Suraj Borade

Solution