PHP date handling

-3

I have this problem and I do not know how to translate it into PHP code: Know how many times a person has attended in a month to a place. But the month begins the day that person came and the month ends 30 days later. That is, if a person comes on the 18th, the interval would be from the 18th to the 18th of the following month. Use PHP and MySQL.

    
asked by DR. ROGELIO Rojas 01.12.2018 в 00:08
source

1 answer

0

So without more data, I can suggest the datediff function of MySQL

For example:

select datediff(@fecha_fin, @fecha_ini) into @d;

Another option is to use INTERVAL, I use this example in the WHERE clause variable $ days, which indicated the number of days from today I will take my query and then paint them in a graph:

where 'FECHA INSERCION' >(select curdate() - INTERVAL $dias DAY) 

I do not know if it's what you're looking for;)

    
answered by 13.12.2018 / 16:35
source