1 | <?php |
---|
2 | /*______________________________________________________________________ |
---|
3 | Cambia de posicion los extremos de una fecha. Devuelve una fecha con formato |
---|
4 | dd-mm-aaaa si el formato de entrada es aaaa-mm-dd y viseversa |
---|
5 | Parametros: |
---|
6 | - fecha: Una cadena con los datos de una fecha |
---|
7 | _______________________________________________________________________*/ |
---|
8 | function InvFecha($fecha){ |
---|
9 | if ($fecha=="1970-01-01")return(""); |
---|
10 | |
---|
11 | $auxexplode=explode(" ",$fecha); |
---|
12 | list($anno_p,$mes_p,$dia_p)=explode("-",str_replace("/","-",$auxexplode[0])); |
---|
13 | $fecha_p=$dia_p.'-'.$mes_p.'-'.$anno_p; |
---|
14 | return($fecha_p); |
---|
15 | } |
---|
16 | //////////////////////////////////////////////////// |
---|
17 | //Convierte fecha de mysql a normal |
---|
18 | //////////////////////////////////////////////////// |
---|
19 | function sacafechaDB($fecha){ |
---|
20 | preg_match("~([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})~", $fecha, $mifecha); |
---|
21 | $lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1]; |
---|
22 | return $lafecha; |
---|
23 | } |
---|
24 | |
---|
25 | //////////////////////////////////////////////////// |
---|
26 | //Convierte fecha de normal a mysql |
---|
27 | //////////////////////////////////////////////////// |
---|
28 | |
---|
29 | function metefechaDB($fecha){ |
---|
30 | preg_match("~([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})~", $fecha, $mifecha); |
---|
31 | $lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1]; |
---|
32 | return $lafecha; |
---|
33 | } |
---|
34 | function HoraValida($hora){ |
---|
35 | if ($hora=="00:00:00")return(""); |
---|
36 | } |
---|
37 | |
---|