Skip to content

Instantly share code, notes, and snippets.

@IgorDePaula
Forked from anonymous/soma_dias_uteis.php
Last active July 4, 2019 18:03
Show Gist options
  • Save IgorDePaula/557b16b56a8f35af672a to your computer and use it in GitHub Desktop.
Save IgorDePaula/557b16b56a8f35af672a to your computer and use it in GitHub Desktop.
<?php
$diasParaSomar = 10;
$dataFinal = new DateTime('now');
while ($diasParaSomar) {
$dataFinal = $dataFinal->add(new DateInterval('P1D'));
if (in_array($dataFinal->format('w'), array(0,6))) {
continue;
}
$diasParaSomar--;
}
echo $dataFinal->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