I want to print a current date in php, but I'm not sure what format it has, the example I should follow is this: "1985-04-12T23: 20: 50.52Z"
I want to print a current date in php, but I'm not sure what format it has, the example I should follow is this: "1985-04-12T23: 20: 50.52Z"
I do not know if it's late but I'm also in the development of electronic invoicing and this worked for me. Source: link
$ahora = DateTime::createFromFormat('U.u', number_format(microtime(true), 3, '.', ''));
$local = $ahora->setTimeZone(new DateTimeZone('America/Bogota'));
$formateado = $local->format("Y-m-d H:i:s.u");
$fecha = substr($formateado, 0, -3).'Z';
I know a simpler way to print the current date and time:
$Ahora = date("Y-m-d H:i:s");
echo $Ahora;
You decide in what format you want it playing with the parameters "Y-m-d H: i: s"