public function offsetDatetime($time = null, $offset = 0)
    {
        if ($this->timeFormat === static::$timeFormatDatetime) {
            return date('Y-m-d H:i:s', strtotime(($offset >= 0 ? "+$offset" : $offset) . " seconds", is_string($time) ? strtotime($time) : (is_int($time) ? $time : time())));
        }
        if ($this->timeFormat === static::$timeFormatTimestamp) {
            return (is_int($time) ? $time : time()) + $offset;
        }
        return null;
    }
public function offsetDatetime($time = null, $offset = 0)
    {
        if ($this->timeFormat === static::$timeFormatDatetime) {
            return date('Y-m-d H:i:s', strtotime(($offset >= 0 ? "+$offset" : $offset) . " seconds", is_string($time) ? strtotime($time) : (is_int($time) ? $time : time())));
        }
        if ($this->timeFormat === static::$timeFormatTimestamp) {
            return (is_int($time) ? $time : time()) + $offset;
        }
        return null;
    }
public function offsetDatetime ( $ time = null , $ offset = 0 ) { if ( $ this -> timeFormat === static :: $ timeFormatDatetime ) { return date ( 'Y-m-d H:i:s' , strtotime ( ( $ offset >= 0 ? "+$offset" : $ offset ) . " seconds" , is_string ( $ time ) ? strtotime ( $ time ) : ( is_int ( $ time ) ? $ time : time ( ) ) ) ) ; } if ( $ this -> timeFormat === static :: $ timeFormatTimestamp ) { return ( is_int ( $ time ) ? $ time : time ( ) ) + $ offset ; } return null ; }
Get offset date & time, by current time format.
@param string|int $time Date &time string or timestamp.
@param int $offset Offset in seconds.
@return string|int Date & time string if format is datetime, or timestamp.
Get offset date & time by current time format .