Example #1
0
	/**
	 * Returns the difference between two dates
	 *
	 * @param null|string|Date|DateTime $date
	 * @param bool                      $absolute [optional] Whether to return absolute difference
	 * @return bool|DateInterval                  The DateInterval object representing the difference between the two dates or FALSE on failure
	 */
	public function diff( $date, $absolute = false )
	{
		if ( ( ! ( $date instanceof Date ) ) && ( ! ( $date instanceof DateTime ) ) ) {
			$diffDate	=	new self( $date, $this->tz, ( $date && ( $date != 'now' ) ? $this->from : null ), $this->config );

			$date		=	$diffDate->getDateTime();
		} elseif ( $date instanceof Date ) {
			$date		=	$date->getDateTime();
		}

		return $this->date->diff( $date, $absolute );
	}