i.php
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/*
$date[0] = strtotime('01.01.2013');
$date[1] = strtotime('01.01.2014');
$date['days'] = floor(($date[1] - $date[0]) / (3600 * 24) / 30);
for($i=0;$i<$date['days'];$i++)
echo date("d:m:y",floor($date[0]+((3600*24)*($i*30)))) . "<br>";
*/
$a_row['min_date'] = '2013-01-01';
$a_row['max_date'] = '2014-01-01';
$date = explode('-', $a_row['min_date']);
$begin_year = $date[0];
$begin_month = $date[1];
$date = explode('-', $a_row['max_date']);
$end_year = $date[0];
$end_month = $date[1];
for ($cur_year = $begin_year; $cur_year <= $end_year; $cur_year++)
{
if ($cur_year == $end_year)
$max_month = $end_month;
else
$max_month = 12;
//
if ($cur_year == $begin_year)
$cur_month = $begin_month;
else
$cur_month = 1;
for ($cur_month; $cur_month <= $max_month; $cur_month++)
{
print ($cur_month < 10 ? $cur_month : $cur_month).'.'.$cur_year.'<br />';
}
}
$start='2013-01-01 10:30:00';
$end='2014-01-01 10:30:00';
$intervalo = date_diff(date_create($start), date_create($end));
print $out = $intervalo->format("%m");
?>