From eda2e96c17d8d22cfc2615698efa5c757dbfb0a5 Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 5 Dec 2022 04:18:15 +0100 Subject: class Dates + templates latex + bugs --- php/DateTimestamp.php | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 php/DateTimestamp.php (limited to 'php/DateTimestamp.php') diff --git a/php/DateTimestamp.php b/php/DateTimestamp.php deleted file mode 100644 index ca07b0a..0000000 --- a/php/DateTimestamp.php +++ /dev/null @@ -1,50 +0,0 @@ - timestamp (int) - private function get_timestamp(): int - { - if(self::$date_format === 'EU') - { - // change jj/mm/aaaa en jj-mm-aaaa - $this->date = preg_replace('#/#', '-', $this->date); - } - elseif(self::$date_format === 'US') - { - // change mm-dd.yyyy en mm/dd/yyyy - $this->date = preg_replace('#[-\.]#', '/', $this->date); - } - else - { - echo('Le fichier config.php comporte une erreur. La variable $date_format doit avoir pour valeur "EU" ou "US"'); - die(); // brutal - } - return(strtotime($this->date)); - // strtotime() devine le format en analysant la chaîne en entrée, on l'aide un peu - // avec des /, php considère que la date est américaine - // avec des - ou des ., php considère que la date est européenne - } - - // timestamp (int) -> date jj-mm-aaaa (string) - private function get_date(): string - { - if(self::$date_format === 'EU') - { - return(date("j-m-Y", $this->date)); - } - elseif(self::$date_format === 'US') - { - return(date("m/d/Y", $this->date)); - } - else - { - echo('Le fichier config.php comporte une erreur. La variable $date_format doit avoir pour valeur "EU" ou "US"'); - die(); // brutal - } - } -} -- cgit v1.2.3