source: admin/WebConsole/includes/InvFecha.php @ 5d05b06

Last change on this file since 5d05b06 was 47580dd, checked in by Irina Gómez <irinagomez@…>, 6 years ago

#921 Fixs 'Action queue': explode in php 7 don't support several delimiters.

  • Property mode set to 100644
File size: 1.3 KB
Line 
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_______________________________________________________________________*/
8function 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////////////////////////////////////////////////////
19function 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
29function 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}
34function HoraValida($hora){
35        if ($hora=="00:00:00")return("");
36}
37
Note: See TracBrowser for help on using the repository browser.