- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo date( 'Y m d h:i:s', strtotime( 'first day of this month' ) ) . "\n";
echo date( 'Y m d h:i:s', strtotime( 'first day of last month' ) ) . "\n";
echo date( 'Y m d h:i:s', strtotime( 'start of first day of this month' ) ) . "\n";