1 | <?php |
||
12 | class DateHeure { |
||
13 | public static $annee; |
||
14 | public static $mois; |
||
15 | public static $jour; |
||
16 | |||
17 | |||
18 | |||
19 | /** |
||
20 | * Fonction pour passer du format H:m en seconde |
||
21 | * @param int $heure recoit l'heure a passer en minute |
||
22 | * @param int $minute recoit les minutes a passer en minute |
||
23 | * @return double|null |
||
24 | **/ |
||
25 | public static function Heureenseconde($heure, $minute) { |
||
38 | |||
39 | /** |
||
40 | * passe des secondes au format H:m |
||
41 | * @return string |
||
42 | */ |
||
43 | public static function Secondeenheure($seconde) { |
||
58 | |||
59 | /** |
||
60 | * fonction qui change le format heure 12:10 en 12h10 |
||
61 | * @param $temps |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public static function ChangerFormatHeure($temps) { |
||
76 | |||
77 | /** |
||
78 | * Transformation de la date format YYYY-mm-jj en jj/mm/aaaa |
||
79 | * @param string $date corespond a la date au format YYYY-mm-jj |
||
80 | * @return string |
||
81 | */ |
||
82 | public static function modif_date_affichage($date) { |
||
83 | $pos = strpos($date, "-"); |
||
84 | |||
85 | if ($pos > 0) { |
||
86 | $explode = explode("-", $date); |
||
87 | $jour = $explode[2]; |
||
88 | $mois = $explode[1]; |
||
89 | $annee = $explode[0]; |
||
90 | |||
91 | self::$jour = $jour; |
||
92 | self::$mois = $mois; |
||
93 | self::$annee = $annee; |
||
94 | |||
95 | return $jour."/".$mois."/".$annee; |
||
96 | } |
||
97 | else { |
||
98 | FlashMessage::setFlash("format de date passé en paramètre ne correspond pas à YYYY-mm-jj"); |
||
99 | FlashMessage::getFlash(); |
||
100 | die(); |
||
101 | } |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * Transformation de la date format jj/mm/aaaa en YYYY-mm-jj pour insertion bdd |
||
106 | * @param string $date corespond a la date au format jj/mm/aaaa |
||
107 | * @return string |
||
108 | */ |
||
109 | public static function modif_date_bdd($date) { |
||
110 | $pos = strpos($date, "/"); |
||
111 | |||
112 | if ($pos > 0) { |
||
113 | $explode = explode("/", $date); |
||
114 | $jour = $explode[0]; |
||
115 | $mois = $explode[1]; |
||
116 | $annee = $explode[2]; |
||
117 | |||
118 | return $annee."-".$mois."-".$jour; |
||
119 | } |
||
120 | else { |
||
121 | FlashMessage::setFlash("Format de date passé en paramètre ne correspond pas à jj/mm/aaaa"); |
||
122 | FlashMessage::getFlash(); |
||
123 | die(); |
||
124 | } |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * fonction qui permet de passer une date d'une bdd en tableau |
||
129 | * @param $date |
||
130 | * @return array |
||
131 | */ |
||
132 | public static function dateBddToArray($date) { |
||
137 | } |