Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Created January 6, 2017 16:44
Show Gist options
  • Select an option

  • Save YurePereira/9e10e3030b9f4571879d37a4548e082d to your computer and use it in GitHub Desktop.

Select an option

Save YurePereira/9e10e3030b9f4571879d37a4548e082d to your computer and use it in GitHub Desktop.
Pegando e formatando a data atual de forma customizada.
<?php
$currentDateTime = new DateTime();
$myFormat = 'Y-m-d H:i:s';
$myFormat2 = 'd-m-Y H:i:s';
$myFormat3 = 'd-m-Y';
echo $currentDateTime->format($myFormat) . PHP_EOL;
echo $currentDateTime->format($myFormat2) . PHP_EOL;
echo $currentDateTime->format($myFormat3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment