Of a given datetime I need the very end of the previous month.
For example:
$date_given = '2019-07-14 16:33:05';
should become:
2019-06-30 23:23:59
I have some possible solutions to make it in several lines. But the requirement for my program/script is to have it in one line. So something like this:
$date_result = ...somefunction..(($date_given) -1 month) ...;
It really would be helpfull to have everything in that one line and not have prior lines with functions.
Thanks.
Here is many solution to this, but if has to be one line i would go with this
echo date_create($date_given.' last day of last month')->format('Y-m-d 23:59:59');