Last active
January 1, 2016 06:49
-
-
Save fatorx/8107429 to your computer and use it in GitHub Desktop.
Somar dias a uma data (via objeto DateTime)
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 | |
$dataOperacao = '2013-12-23 15:16:17'; | |
$format = 'Y-m-d H:i:s'; | |
$date = DateTime::createFromFormat($format, $dataOperacao); | |
$date->add(new DateInterval('P365D')); | |
echo $date->format('Y-m-d') . "\n"; | |
/** | |
* lê-se os argumentos de DateInterval da seguinte forma: periodo de 365 dias (period of 365 days) | |
* para mais informações: http://www.php.net/manual/en/class.datetime.php | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment