1

Topic: How to receive all records for a day

I derive from a DB of record with creation date as on PHP it is possible to define that records in a type
2018-03-29 3:05:03 PM
And
2018-03-29 3:15:03 PM
Concern one day
That is it is necessary as that to remove hours and to leave only 2018-03-29 that it was possible to compare
How it to make?

2

Re: How to receive all records for a day

On PHP it is possible to take stupidly first ten characters from a line with date and to compare them.
It is possible is more advanced to stir up - to use object of date and in it to manipulate an output format.
PS: Only it is all nonsenses if date in the pure state can be received at once from a DBMS.

3

Re: How to receive all records for a day

trom;
DB what? It is normal all made DBMS are able to derive from date-time only date, day, year, month, etc.

4

Re: How to receive all records for a day

trom;
Most elementarily likely to write

WHERE ` date ` BETWEEN ' 2018-03-29 0:00:00 AM ' AND ' 2018-03-29 11:59:59 PM'

5

Re: How to receive all records for a day

vkle;
And it is possible example how to take the first 10 characters or a function title?
DarkMaster
MikkiMouse
DB Postgres

6

Re: How to receive all records for a day

trom;
http://php.net/manual/ru/function.substr.php

7

Re: How to receive all records for a day

trom;

select cast (datetimefield as date) from mytable

Here also there will be to you only a date. A condition in where you can generate?

8

Re: How to receive all records for a day

DarkMaster wrote:

trom;

select cast (datetimefield as date) from mytable

Here also there will be to you only a date. A condition in where you can generate?

Yes all perfectly works as thanks!
vkle
Thanks function was useful