function ToEpoc($date, $ref = null) {
		if (preg_match('!^[0-9]{10,}$!', $date)) { // Unix time stamp
			return $date;
		} else if (preg_match('!^[0-9]{4}$!', $date)) { // Just year
			return strtotime("$date-01-01");
		} else if (preg_match('!^[0-9]{4}-[0-9]{2}$!', $date)) { // Year + month
			return strtotime("$date-01");
		} elseif ($month = array_search($date, $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')) ) {
			if ($ref && isset($ref['year'])) { // We have a year to glue it to
				return strtotime("{$ref['year']}-{$months[$month]}-01");
			} else
				return false; // We have the month but don't know anything else
		} else
			return strtotime($date);
	}