Created
July 29, 2019 22:03
-
-
Save parzibyte/84c463e9c6f1fee8d621555266cff4da to your computer and use it in GitHub Desktop.
Extraer datos de fecha con PHP https://parzibyte.me/blog/2018/07/30/extraer-anio-mes-dia-fecha-php/
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
<?php | |
$fecha = "2018-07-30T20:55:20"; | |
$fechaEntera = strtotime($fecha); | |
$anio = date("Y", $fechaEntera); | |
$mes = date("m", $fechaEntera); | |
$dia = date("d", $fechaEntera); | |
$hora = date("H", $fechaEntera); | |
$minutos = date("i", $fechaEntera); | |
$segundos = date("s", $fechaEntera); | |
#Notar que es lo mismo que hacer | |
# date("Y-m-d H:i:s") | |
echo "$anio-$mes-$dia $hora:$minutos:$segundos"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment