Q:

Write a PHP script to get the first and last day of a month from a specified date

0

Write a PHP script to get the first and last day of a month from a specified date.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$dt = "2008-02-23";
echo 'First day : '. date("Y-m-01", strtotime($dt)).' - Last day : '. date("Y-m-t", strtotime($dt)); 
?>

Sample Output:

First day : 2008-02-01 - Last day : 2008-02-29

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now