The date string looks like this
2011-08-19 17:14:40
(year-month-day hours:minutes:seconds)
How can I find out if the date is older than
With the meringue library, this can be done in at least two ways.
The first one looks like the following:
(new Future(
new DateTimeParsedFromISO8601String('2011-08-19 17:14:40'),
new NDays(30)
))
->earlierThan(
new Now()
);
The semantics is the following: first, you parse a date from an ISO8601 string, then create a future date which is thirty days later than that, and finally compare it with current datetime, that is, now.
The second way is creating an interval from a datetime range and counting the days it consists of. It looks like that:
(new TotalFullDays(
new FromRange(
new FromISO8601('2011-08-19 17:14:40'),
new Now()
)
))
->value();
Both approaches are quite intuitive and don't make you remember special php datetime expressions. Instead, every implementation is autocompleted; you just need to build a correct object that suits your needs.