Skip to content

Instantly share code, notes, and snippets.

@felipelavinz
Last active December 30, 2015 01:59
Show Gist options
  • Save felipelavinz/7760052 to your computer and use it in GitHub Desktop.
Save felipelavinz/7760052 to your computer and use it in GitHub Desktop.
<?php
$timezone = new DateTimeZone('America/Santiago');
$now = new DateTimeImmutable('now', $timezone );
$dds = $now->format('N');
switch ( $dds ){
// sabado
case 6:
$hoy = $now;
$manana = $hoy->add( new DateInterval('P2D', $timezone) );
break;
// domingo
case 7:
$hoy = $now->add( new DateInterval('P1D', $timezone) );
$manana = $hoy->add( new DateInterval('P2D', $timezone ) );
break;
default:
$hoy = $now;
$manana = $hoy->add( new DateInterval('P1D', $timezone ) );
break;
}
$dia_hoy = $hoy->format('N');
$dia_manana = $manana->format('N');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment