Vorige maand en volgende maand uit bepaalde datum
Thomas de Roo
26/10/2010 15:04:41Ik heb een stuk code, dat van de vorige, huidige en komende maand een kalender laat zien, nu is mijn vraag, hoe kan ik dit gebruiken in combinatie met een gegeven maand en jaar (bijv: 05;2010 of 11;2010)?
Echt verder dan
kom ik niet....
Thomas
Echt verder dan
kom ik niet....
Thomas
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$today = date("Y-m-d");
$nextmonth = date("Y-m-d",strtotime("+1 months"));
$premonth = date("Y-m-d",strtotime("-1 months"));
$today_month = date("m", strtotime($today));
$nextmonth_month = date("m", strtotime($nextmonth));
$premonth_month = date("m", strtotime($premonth));
$today_year = date("Y", strtotime($today));
$nextmonth_year = date("Y", strtotime($nextmonth));
$premonth_year = date("Y", strtotime($premonth));
$parameters = array(
'today' => $today_month.";".$today_year,
'nextmonth' => $nextmonth_month.";".$nextmonth_year,
'premonth' => $premonth_month.";".$premonth_year
);
echoCalendar($parameters["premonth"]);
echoCalendar($parameters["today"]);
echoCalendar($parameters["nextmonth"]);
?>
$today = date("Y-m-d");
$nextmonth = date("Y-m-d",strtotime("+1 months"));
$premonth = date("Y-m-d",strtotime("-1 months"));
$today_month = date("m", strtotime($today));
$nextmonth_month = date("m", strtotime($nextmonth));
$premonth_month = date("m", strtotime($premonth));
$today_year = date("Y", strtotime($today));
$nextmonth_year = date("Y", strtotime($nextmonth));
$premonth_year = date("Y", strtotime($premonth));
$parameters = array(
'today' => $today_month.";".$today_year,
'nextmonth' => $nextmonth_month.";".$nextmonth_year,
'premonth' => $premonth_month.";".$premonth_year
);
echoCalendar($parameters["premonth"]);
echoCalendar($parameters["today"]);
echoCalendar($parameters["nextmonth"]);
?>
PHP hulp
02/06/2024 16:43:45datetime classes gebruiken.