Reputation:
Here is my php function for taking First day & last day of a month.
$start = strtotime($fromDate);
$first_second = date('Y-m-01', $start);
$last_second = date('Y-m-t', $start);
My question is How can i take the day number form the date.For eg:If date is 28th february I want to get output as 28 only.
Upvotes: 0
Views: 48
Reputation: 796
Try this
$fromDate=date('Y-m-d');
$date_array=getdate(strtotime($fromDate));
print_r($date_array);
The output will be
Array
(
[seconds] => 0
[minutes] => 0
[hours] => 0
[mday] => 8
[wday] => 5
[mon] => 2
[year] => 2019
[yday] => 38
[weekday] => Friday
[month] => February
[0] => 1549584000
)
Take value from array as per your requirement.
Upvotes: 1