From 877f4365b70f1a8b3420cb5a891e7a7d29bf4346 Mon Sep 17 00:00:00 2001 From: Jem Date: Mon, 21 May 2018 23:26:21 +0200 Subject: [PATCH] =?utf8?q?Se=20importa=20la=20funci=C3=B3n=20fecha()=20cre?= =?utf8?q?ada=20por=20jem?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- html/gec.php | 3 ++- html/wiki.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/html/gec.php b/html/gec.php index c13eebd..c8c899c 100644 --- a/html/gec.php +++ b/html/gec.php @@ -23,4 +23,5 @@ function infogrupo ($G, $DE, $DI, $DP, $DT) { } return $Info; } -?> \ No newline at end of file + +?> diff --git a/html/wiki.php b/html/wiki.php index dfbc6a5..f0a2fc2 100644 --- a/html/wiki.php +++ b/html/wiki.php @@ -15,6 +15,21 @@ function parsecfg ($F) { # Se admiten matrices numéricas return $D; } +function fecha ($F, $DI, $Extras = array ("Año")) { + $T = ($F > 946684800 ? $F : strtotime (chop ($F, "Z"))); # Convertir a timestamp si no lo es (comparamos con el timestamp de 2000-01-01 00:00 UTC) + if ($DI["formato fecha"] == "ISO") { + $R = date ("Y-m-d", $T); + if (in_array ("Hora", $Extras)) $R .= date (", H:i", $T); + } else { + if (in_array ("DíaSem", $Extras)) $D = (in_array ("Larga", $Extras) ? "{$DI["díasemc"][date ("N", $T)]}, " : "{$DI["díasem"][date ("N", $T)]} "); + $A = (in_array ("Año", $Extras) ? " Y" : ""); + if (in_array ("Hora", $Extras)) $H = ", H:i" . (in_array ("Larga", $Extras) ? " (e)" : ""); + $M = (in_array ("Larga", $Extras) ? "de " . $DI["mesc"][date ("n", $T)] . ($A ? " de" : "") : $DI["mes"][date ("n", $T)]); + $R = $D . (date ("j ", $T) . $M . date ("{$A}{$H}", $T)); + } + return ($F ? $R : "N/D"); +} + function wikiencode ($URLA, $URLB = NULL, $URLC = NULL, $MI = AZ, $MF = az) { $Cambios = array ( "+" => "_", "%3A" => ":", "%2F" => "/", # Inversión de urlencodes -- 2.30.2