Last active
June 29, 2017 16:05
-
-
Save EADAR/bf6c3e3d853a2522a4d2beaab3e69589 to your computer and use it in GitHub Desktop.
CLASS | Gestion des dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Classes; // Définisez votre propre namespace | |
class date | |
{ | |
private $NomsJours = [ | |
"Dimanche", | |
"Lundi", | |
"Mardi", | |
"Mercredi", | |
"Jeudi", | |
"Vendredi", | |
"Samedi" | |
]; | |
private $NomsMois = [ | |
"Décembre", | |
"Janvier", | |
"Février", | |
"Mars", | |
"Avril", | |
"Mai", | |
"Juin", | |
"Juillet", | |
"Août", | |
"Septembre", | |
"Octobre", | |
"Novembre" | |
]; | |
public function timestampToFullNumericDate($data) | |
{ | |
return date('d/m/Y', $data) . ' ' . date('H:i:s', $data); | |
} | |
public function timestampToNumericDate($data) | |
{ | |
return date('d/m/Y', $data); | |
} | |
public function timestampToHour($data) | |
{ | |
return date('H:i:s', $data); | |
} | |
public function timestampToFullTextDate($data) | |
{ | |
return $this->NomsJours[date("w", $data)] . " " . date("j", $data) . " " . $this->NomsMois[date("n", $data)] . " " . date("Y", $data); | |
} | |
public function timestampToTextDate($data) | |
{ | |
return date("j", $data) . " " . $this->NomsMois[date("n", $data)] . " " . date("Y", $data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment