Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created July 29, 2019 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/84c463e9c6f1fee8d621555266cff4da to your computer and use it in GitHub Desktop.
Save parzibyte/84c463e9c6f1fee8d621555266cff4da to your computer and use it in GitHub Desktop.
<?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