Last active
January 6, 2017 21:04
-
-
Save YurePereira/0ba11a74b1e4add741c359f732e587bc to your computer and use it in GitHub Desktop.
Pegando datas relativas a data atual
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 | |
| $now = new DateTime('now');//Valor padrão | |
| $today = new DateTime('today'); | |
| $yesterday = new DateTime('yesterday'); | |
| $tomorrow = new DateTime('tomorrow'); | |
| echo 'Now: ' . $now->format('d-m-Y H:i:m') . PHP_EOL; | |
| echo 'Today: ' . $today->format('d-m-Y H:i:m') . PHP_EOL; | |
| echo 'Yesterday: ' . $yesterday->format('d-m-Y H:i:m') . PHP_EOL; | |
| echo 'Tomorrow: ' . $tomorrow->format('d-m-Y H:i:m'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment