private function formatDate($when = null)
    {
        if (!$when) {
            // now
            $when = $this->formatFloatTimeToDate(microtime(true));
        } elseif (is_numeric($when)) {
            $when = $this->formatFloatTimeToDate($when);
        } elseif (!$when instanceof \DateTimeInterface) {
            throw new \InvalidArgumentException('Invalid date format. Must be a \DateTimeInterface or numeric.');
        }
        $when->setTimezone(new \DateTimeZone('UTC'));
        return $when;
    }
private function formatDate($when = null)
    {
        if (!$when) {
            // now
            $when = $this->formatFloatTimeToDate(microtime(true));
        } elseif (is_numeric($when)) {
            $when = $this->formatFloatTimeToDate($when);
        } elseif (!$when instanceof \DateTimeInterface) {
            throw new \InvalidArgumentException('Invalid date format. Must be a \DateTimeInterface or numeric.');
        }
        $when->setTimezone(new \DateTimeZone('UTC'));
        return $when;
    }
private function formatDate ( $ when = null ) { if ( ! $ when ) { // now $ when = $ this -> formatFloatTimeToDate ( microtime ( true ) ) ; } elseif ( is_numeric ( $ when ) ) { $ when = $ this -> formatFloatTimeToDate ( $ when ) ; } elseif ( ! $ when instanceof \ DateTimeInterface ) { throw new \ InvalidArgumentException ( 'Invalid date format. Must be a \DateTimeInterface or numeric.' ) ; } $ when -> setTimezone ( new \ DateTimeZone ( 'UTC' ) ) ; return $ when ; }
Handles parsing a \DateTimeInterface object from a provided timestamp.

@param  \DateTimeInterface|int|float $when [optional] The end time of this span.
**Defaults to** now. If provided as an int or float, it is expected to be a Unix timestamp.
@return \DateTimeInterface
@throws \InvalidArgumentException
Handles parsing a \ DateTimeInterface object from a provided timestamp .