Skip to content
Advertisement

How to read from the two same dates without input the time

I have a query like below.

When I submit a date like the following patients.created_at BETWEEN '2018-05-22' AND '2018-05-22' it doesn’t return anything but if I enter BETWEEN '2018-05-22' patients.created_at 'AND' 2018-05-23' it returns a value.

I think if I just input two of the same date without entering the time then the time will be 00:00:00 - 00:00:00.

How to read 00:00:00 - 23:59:59 when we input two of the same date without entering the time?

The date format in the table is filled as follows "Thursday, August 20, 2020, 9:49 AM" but it can be read if we just input the date, for example 2020-08-20.

Your help means a lot to me, thank you

Advertisement

Answer

if your data type is datetime then you can add:

because 2018-05-22 = 2018-05-22 00:00:00

if you want to input only one date, then u can use this

or you can simply use this

it will give you all of the row which has the value ‘2018-05-22’ on it

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement