Last active
June 19, 2019 14:52
-
-
Save YurePereira/53c7dae30f0844bf158ab181c7d9610a to your computer and use it in GitHub Desktop.
Subtraindo um intervalo de tempo de uma data
This file contains hidden or 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 | |
| $dateTime = new DateTime('2016-12-01 00:00:01'); | |
| echo $dateTime->format('d/m/Y H:i:s') . PHP_EOL; | |
| //Subtraindo 3 anos e 2 meses de nossa data | |
| $dateTime->sub(new DateInterval('P3Y2M')); | |
| echo $dateTime->format('d/m/Y H:i:s'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment