Answer the question
In order to leave comments, you need to log in
How to work with dates?
Hello.
There is a following task: from basis it is necessary to get records for a certain period of time. The date is stored in the database in numerical form (for example: 1449500400). At first glance, I see the following work option: we convert it to a normal date and add the required interval through DateInterval, then we convert it back and look for it.
But maybe there is a shorter way to add for example a week to a number in milliseconds?
Thanks in advance to all who respond.
Answer the question
In order to leave comments, you need to log in
... WHERE created_at BETWEEN @a1 AND @a2
where @a1 = strtotime(date('2015-01-05 00:00:00'))
@a2 = strtotime('-20 days');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question