function formatDate($dateStr=null,$includeTime=null){
		if($dateStr === null){
			$date = time();
		}else if(is_string($dateStr)){
			$date = strtotime($dateStr);
		}else if(is_integer($dateStr)){
			$date = $dateStr;
		}else{
			throw new InvalidInputException('1st parameter should be either a string or integer or null');
		}
		$format = "Y-m-d";
		if(isset($includeTime)){
			$format .= " H:i:s";
		}
		$mysqlDate = date($format,$date);
		return $mysqlDate;
	}
function formatDate($dateStr=null,$includeTime=null){
		if($dateStr === null){
			$date = time();
		}else if(is_string($dateStr)){
			$date = strtotime($dateStr);
		}else if(is_integer($dateStr)){
			$date = $dateStr;
		}else{
			throw new InvalidInputException('1st parameter should be either a string or integer or null');
		}
		$format = "Y-m-d";
		if(isset($includeTime)){
			$format .= " H:i:s";
		}
		$mysqlDate = date($format,$date);
		return $mysqlDate;
	}
function formatDate ( $ dateStr = null , $ includeTime = null ) { if ( $ dateStr === null ) { $ date = time ( ) ; } else if ( is_string ( $ dateStr ) ) { $ date = strtotime ( $ dateStr ) ; } else if ( is_integer ( $ dateStr ) ) { $ date = $ dateStr ; } else { throw new InvalidInputException ( '1st parameter should be either a string or integer or null' ) ; } $ format = "Y-m-d" ; if ( isset ( $ includeTime ) ) { $ format .= " H:i:s" ; } $ mysqlDate = date ( $ format , $ date ) ; return $ mysqlDate ; }
this method formats date for this connection

@param string|integer $dateStr time in string or timestamp in integer
@param boolean $includeTime

@return string , formatted date as string
this method formats date for this connection