Example, php gets the first and last day of each month.
PHP date function date usage.
-
- function getthemonth($date)
- {
- $firstday = date('y-m-01', strtotime($date));
- $lastday = date('y-m-d', strtotime("$firstday +1 month -1 day"));
- return array($firstday,$lastday);
- }
- $today = date("y-m-d");
- $day=getthemonth($today);
- ?>
Copy code
|