@ 2018-02-04T16:46:19Z <?php
$time_str = '1:47 PM';
$tz_str = 'America/New_York';
$timestamp = time();
$datetime = new DateTime("now", new DateTimeZone($tz_str)); //first argument "must" be a string
$datetime->setTimestamp($timestamp); //adjust the object to correct timestamp
//$datetime = new DateTime( '2010-05' );
$datetime->modify( 'first day of +0 month' );
echo $datetime->format( 'F' ), "\n";
echo $datetime->format('w d.m.Y, H:i:s') . "\n";
echo $datetime->format('m.Y') . "\n";
$datetime->modify( 'fourth thursday of +0 month' );
echo $datetime->format( 'F' ), "\n";
echo $datetime->format('w d.m.Y, H:i:s') . "\n";
echo $datetime->format('m.Y') . "\n";
$datetime->modify( 'first day of +1 month' );
echo $datetime->format( 'F' ), "\n";
echo $datetime->format('w d.m.Y, H:i:s') . "\n";
echo $datetime->format('m.Y') . "\n";
$datetime->modify('+1 day' );
echo $datetime->format( 'F' ), "\n";
echo $datetime->format('w d.m.Y, H:i:s') . "\n";
echo $datetime->format('m.Y') . "\n";
$datetime->modify('last day of previous month')->modify('+10 day');
echo $datetime->format( 'F' ), "\n";
echo $datetime->format('w d.m.Y, H:i:s') . "\n";
echo $datetime->format('m.Y') . "\n";
$datetime->format('2000-12-10');
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.1.0 - 7.1.20 , 7.2.0 - 7.2.6 February
4 01.02.2018, 11:46:19
02.2018
February
4 22.02.2018, 00:00:00
02.2018
March
4 01.03.2018, 00:00:00
03.2018
March
5 02.03.2018, 00:00:00
03.2018
March
6 10.03.2018, 00:00:00
03.2018
preferences:dark mode live preview
58.66 ms | 402 KiB | 25 Q