Exemple #1
0
	/**
	 * Compares the month of the current date against the given $date month
	 * Returns 0 if equal, -1 if current month is earlier or 1 if current month is later
	 * For example: 10.03.2000 -> 15.03.1950 -> 0
	 *
	 * @param  Piwik_Date  $month   Month to compare
	 * @return integer  0 = equal, 1 = later, -1 = earlier
	 */
	function compareMonth( Piwik_Date $date )
	{
		$currentMonth = date('n', $this->getTimestamp());
		$toCompareMonth = date('n', $date->getTimestamp());
		if( $currentMonth == $toCompareMonth)
		{
			return 0;
		}
		if( $currentMonth < $toCompareMonth)
		{
			return -1;
		}
		return 1;
	}