comparer deux DateTime - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of comparer deux DateTime.php
- <?php
- $str = "27.08.2019";
- $tab = explode(".",$str);
- $timestamp = mktime(0,0,0,$tab[1],$tab[0],$tab[2]);
- $dateDuJour = new DateTime();$dateDuJour->setTimestamp(time());
- echo $dateDuJour->format("d/m/Y")."\n";
- $maDate = new DateTime();
- $maDate->setTimestamp($timestamp);
- echo $maDate->format("d/m/Y");
- if($maDate<$dateDuJour) exit('Trop vieux');
- if($maDate >= $dateDuJour) exit('Ok');
- ?>
File Description
- comparer deux DateTime
- PHP Code
- 30 Aug-2019
- 393 Bytes
You can Share it:
Latest PHP Pastes