How can I get the first day of the previous month to start? I am currently using this:
$date = new DateTime('first day of last month');
This gives me the first day of last month, but in relation to my current time. What I'm actually trying to do is start from the time zone. For example:
$date = new DateTime('first day of previous month', new DateTimeZone('UTC'));
The result will be July 1, 2013 00:00:00. Or if I use:
$date = new DateTime('first day of previous month', new DateTimeZone('Europe/Amsterdam'));
Expected Result: June 30, 2013, 9:00 p.m. (due to its displacement).
How to do it using PHP?
php datetime
Jane deuschandell
source share