[2] | 1 | <?php
|
---|
| 2 | // *****************************************************************************************************************************
|
---|
| 3 | // Funzioni formattazione data e altro
|
---|
| 4 | // *****************************************************************************************************************************
|
---|
| 5 |
|
---|
| 6 |
|
---|
[36] | 7 | function giorno($min,$max)
|
---|
[2] | 8 | {
|
---|
| 9 | $giorno='';
|
---|
[79] | 10 | if(!$min) $min='1';
|
---|
[36] | 11 | if(!$max) $max='31';
|
---|
| 12 | $giorni=array();
|
---|
| 13 | for($x=$min;$x<=$max;$x++) $giorni[]=$x;
|
---|
| 14 | #$giorni= array('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
|
---|
[2] | 15 | foreach($giorni as $gi)
|
---|
| 16 | $giorno .= "<option value=$gi>$gi</option>";
|
---|
| 17 | $giorno .= "</select>";
|
---|
| 18 | echo "$giorno";
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | function mese()
|
---|
| 23 | {
|
---|
| 24 | $mese='';
|
---|
| 25 | $mesi= array('01','02','03','04','05','06','07','08','09','10','11','12');
|
---|
| 26 | foreach($mesi as $me)
|
---|
| 27 | $mese .= "<option value=$me>$me </option>";
|
---|
| 28 | $mese .= "</select>";
|
---|
| 29 | echo "$mese";
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | function anno()
|
---|
| 33 | {
|
---|
| 34 | $anno ='';
|
---|
| 35 | $curr=date("Y",time());
|
---|
| 36 | $curr++;
|
---|
| 37 | $anni=array($curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--);
|
---|
| 38 | foreach($anni as $an)
|
---|
| 39 | $anno .= "<option value=$an>$an</option>";
|
---|
| 40 | $anno .= "</select>";
|
---|
| 41 | echo "$anno";
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[36] | 44 | function ore($min,$max)
|
---|
[2] | 45 | {
|
---|
| 46 | $ora='';
|
---|
| 47 | $ore= array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24');
|
---|
| 48 | foreach($ore as $ori)
|
---|
| 49 | $ora .= "<option value=$ori>$ori</option>";
|
---|
| 50 | $ora .= "</select>";
|
---|
| 51 | echo "$ora";
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | function minuti()
|
---|
| 56 | {
|
---|
| 57 | $minuto='';
|
---|
| 58 | $minuti= array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14',
|
---|
| 59 | '15', '16', '17', '18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
|
---|
| 60 | '34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50',
|
---|
| 61 | '51','52','53','54','55','56','57','58','59');
|
---|
| 62 | foreach($minuti as $minu)
|
---|
| 63 | $minuto .= "<option value=$minu>$minu </option>";
|
---|
| 64 | $minuto .= "</select>";
|
---|
| 65 | echo "$minuto";
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | function secondi()
|
---|
| 69 | {
|
---|
| 70 | $secondo='';
|
---|
| 71 | $secondi= array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14',
|
---|
| 72 | '15', '16', '17', '18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
|
---|
| 73 | '34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50',
|
---|
| 74 | '51','52','53','54','55','56','57','58','59');
|
---|
| 75 | foreach($secondi as $sec)
|
---|
| 76 | $secondo .= "<option value=$sec>$sec</option>";
|
---|
| 77 | $secondo .= "</select>";
|
---|
| 78 | echo "$secondo";
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | function form_data($data)
|
---|
| 84 |
|
---|
| 85 | {
|
---|
| 86 | list($anno,$mese,$giorno) = explode("-", $data) ;
|
---|
| 87 | if ($giorno>0)
|
---|
| 88 | return("$giorno-$mese-$anno");
|
---|
| 89 | else
|
---|
| 90 | return(" ");
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 | ?>
|
---|