What I want to do is get 1st date of current month
Here is how to get last day of the current month
date('d-m-Y', strtotime('last day of this month'))
I've tried to use this, but it didn't work for me
date('d-m-Y', strtotime('first day of this month'))
Any idea how to solve my problem ?
php $dt = "2008-02-23"; echo 'First day : '. date("Y-m-01", strtotime($dt)).
php echo 'First Date = ' . date('Y-m-01') . '<br />'; echo 'Last Date = ' . date('Y-m-t') .
Use strtotime() function to get the first day of week using PHP. This function returns the default time variable timestamp and then use date() function to convert timestamp date into understandable date. strtotime() Function: The strtotime() function returns the result in timestamp by parsing the time string.
date('01-m-Y')
should do it ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With