13
Apr
Learn how to get first and last date of the month using php
The easiest way is to use date function, which lets you mix hard-coded values with ones extracted from a timestamp. If you don’t give a timestamp, it assumes the current date and time.
<?php // Current timestamp is assumed, so these find first and last day of THIS month $first_day_this_month = date('m-01-Y'); // hard-coded '01' for first day $last_day_this_month = date('m-t-Y'); ?>