Skip to content

Instantly share code, notes, and snippets.

@YurePereira
Last active June 19, 2019 14:52
Show Gist options
  • Select an option

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

Select an option

Save YurePereira/ce9bb1ec2aa34294e6609d497a1ac093 to your computer and use it in GitHub Desktop.
Usando os métodos setDate e setTime para definir datas
<?php
$dateTime = new DateTime();
//Date
$year = 2000; $month = 10; $day = 12;
//Time
$hour = 9; $minute = 1; $second = 10;
$dateTime->setDate($year, $month, $day);
$dateTime->setTime($hour, $minute, $second);
echo $dateTime->format('d/m/Y H:i:s');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment