-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.php
45 lines (41 loc) · 1.03 KB
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
function getDatetime($fecha, $type = "all")
{
$date = new DateTime($fecha);
$mes = [
1 => "Enero",
2 => "Febrero",
3 => "Marzo",
4 => "Abril",
5 => "Mayo",
6 => "Junio",
7 => "Julio",
8 => "Agosto",
9 => "Sertiembre",
10 => "Octubre",
11 => "Noviembre",
12 => "Diciembre"
];
$dia = [
0 => "Lunes",
1 => "Martes",
2 => "Miercoles",
3 => "Jueves",
4 => "Viernes",
5 => "Sabado",
6 => "Domingo"
];
$string_formato = "";
if ($type == "all") {
$string_formato = $dia[$date->format("w")] .
" <em><b>" . $date->format("j") .
" de " . $mes[$date->format("n")] .
"</b></em> del " . $date->format("Y");
} else {
$string_formato = $dia[$date->format("w")] .
" " . $date->format("j") .
" de " . $mes[$date->format("n")] .
" del " . $date->format("Y");
}
return $string_formato;
}