source: trunk/www/dch/dates.php@ 15437

Last change on this file since 15437 was 15437, checked in by Daniela Dorner, 11 years ago
added button Tonight
File size: 2.2 KB
Line 
1<script type="text/javascript">
2function change (wert)
3{
4 document.formular.date.value=wert;
5}
6</script>
7<?php
8
9function GetDates($date, $name)
10{
11 if (!empty($_GET["date"]))
12 $date=date("Y-m-d", strtotime($_GET["date"]));
13 else
14 $date=date("Y-m-d");
15
16 $plusoneday=date("Y-m-d", strtotime($date." +1 day"));
17 $minusoneday=date("Y-m-d", strtotime($date." -1 day"));
18 $plusoneweek=date("Y-m-d", strtotime($date." +1 week"));
19 $minusoneweek=date("Y-m-d", strtotime($date." -1 week"));
20 $plustwoweeks=date("Y-m-d", strtotime($date." +2 week"));
21 $minustwoweeks=date("Y-m-d", strtotime($date." -2 week"));
22 $plusonemonth=date("Y-m-d", strtotime($date." +1 month"));
23 $minusonemonth=date("Y-m-d", strtotime($date." -1 month"));
24 $plusoneyear=date("Y-m-d", strtotime($date." +1 year"));
25 $minusoneyear=date("Y-m-d", strtotime($date." -1 year"));
26 $today=date("Y-m-d",mktime(-12,0,0,date("m"), date("d"), date("Y")));
27
28 printf("<input name='date' type='text' size='10' maxlength='10' value='%s'>\n", $date);
29 echo "<input type='submit' value='Show'>\n";
30 printf("<input type='button' value='Tonight' onClick='change(\"%s\");submit()'>\n", $today);
31 printf("<input type='button' value='+1Day' onClick='change(\"%s\");submit()'>\n", $plusoneday);
32 printf("<input type='button' value='-1Day' onClick='change(\"%s\");submit()'>\n", $minusoneday);
33 printf("<input type='button' value='+1Week' onClick='change(\"%s\");submit()'>\n", $plusoneweek);
34 printf("<input type='button' value='-1Week' onClick='change(\"%s\");submit()'>\n", $minusoneweek);
35 printf("<input type='button' value='+2Weeks' onClick='change(\"%s\");submit()'>\n", $plustwoweeks);
36 printf("<input type='button' value='-2Weeks' onClick='change(\"%s\");submit()'>\n", $minustwoweeks);
37 printf("<input type='button' value='+1Month' onClick='change(\"%s\");submit()'>\n", $plusonemonth);
38 printf("<input type='button' value='-1Month' onClick='change(\"%s\");submit()'>\n", $minusonemonth);
39 printf("<input type='button' value='+1Year' onClick='change(\"%s\");submit()'>\n", $plusoneyear);
40 printf("<input type='button' value='-1Year' onClick='change(\"%s\");submit()'>\n", $minusoneyear);
41
42 return $date;
43}
44
45?>
Note: See TracBrowser for help on using the repository browser.