Created
May 10, 2016 12:28
-
-
Save jgdoncel/9c43fbdcec849108d2d523f9c2de3193 to your computer and use it in GitHub Desktop.
Parsear una fecha y sumarle horas
This file contains 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
$fecha = date_create_from_format('d/m/Y H:i:s', '08/09/1969 15:32:21'); | |
echo "Fecha: " . $fecha->format('Y-m-d H:i:s') . "<br/>"; | |
$horas = 24; | |
echo "Fecha+24h: " . $fecha->add(new \DateInterval('PT' . $horas . 'H'))->format('Y-m-d H:i:s') . "<br/>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment