Ejemplo n.º 1
0
 public static function currentTimePoints()
 {
     $dtNow = new \DateTime();
     $timestamp = time();
     // Set a non-default timezone if needed
     $dtNow->setTimestamp($timestamp);
     $beginOfDay = clone $dtNow;
     // Go to midnight.  ->modify('midnight') does not do this for some reason
     $beginOfDay->setTime(0, 0, 0);
     $endOfDay = clone $beginOfDay;
     $endOfDay->modify('tomorrow');
     // adjust from the next day to the end of the day, per original question
     $endOfDay->modify('1 second ago');
     return ['time' => $timestamp, 'start' => strtotime($beginOfDay->format('m/d/Y H:i:s e')), 'end' => strtotime($endOfDay->format('m/d/Y H:i:s e'))];
 }