Welcome to CodeCoruses.eu

welcome.jpg

English | Norwegian

Coding Fora logo
  • main_navigation_menu_icon.png
  • Search
  • ic_more_vert.png

PHP previous month

You are here
Fora > PHP previous month

1_180303121314.jpg
Administrator

vote_up

0

vote_down

Posted by Administrator · 25 September 2018 (16402 days ago) · Report · Email

$month = date("m");
$year = date("Y");

// Previous month
if($month == "01"){
$month_previous = "12";
$year_previous = $year-1;
}
else{
$month_previous = $month-1;
$year_previous = $year;
}

Reply

Social Media

youtube.png