public static function GetAsDate($fieldname, $default = "date('Y-m-d')", $includetime = false)
	{
		$returnVal = self::Get($fieldname,$default);

		if ($returnVal == "date('Y-m-d')")
		{
			return date('Y-m-d');
		}
		elseif ($returnVal == "date('Y-m-d H:i:s')")
		{
			return date('Y-m-d H:i:s');
		}
		elseif ($returnVal == "")
		{
			return "";
		}
		else
		{
			if ($includetime)
			{
				if (self::Get($fieldname."Hour"))
				{
					$hour = self::Get($fieldname."Hour",date("H"));
					$minute = self::Get($fieldname."Minute",date("i"));
					$ampm = self::Get($fieldname."AMPM","AM");

					if ($ampm == "PM")
					{
						$hour = ($hour*1)+12;
					}
					$returnVal .= " " . $hour . ":" . $minute . ":" . "00";
				}

				return date("Y-m-d H:i:s",strtotime($returnVal));
			}
			else
			{
				return date("Y-m-d",strtotime($returnVal));
			}
		}
	}
public static function GetAsDate($fieldname, $default = "date('Y-m-d')", $includetime = false)
	{
		$returnVal = self::Get($fieldname,$default);

		if ($returnVal == "date('Y-m-d')")
		{
			return date('Y-m-d');
		}
		elseif ($returnVal == "date('Y-m-d H:i:s')")
		{
			return date('Y-m-d H:i:s');
		}
		elseif ($returnVal == "")
		{
			return "";
		}
		else
		{
			if ($includetime)
			{
				if (self::Get($fieldname."Hour"))
				{
					$hour = self::Get($fieldname."Hour",date("H"));
					$minute = self::Get($fieldname."Minute",date("i"));
					$ampm = self::Get($fieldname."AMPM","AM");

					if ($ampm == "PM")
					{
						$hour = ($hour*1)+12;
					}
					$returnVal .= " " . $hour . ":" . $minute . ":" . "00";
				}

				return date("Y-m-d H:i:s",strtotime($returnVal));
			}
			else
			{
				return date("Y-m-d",strtotime($returnVal));
			}
		}
	}
public static function GetAsDate ( $ fieldname , $ default = "date('Y-m-d')" , $ includetime = false ) { $ returnVal = self :: Get ( $ fieldname , $ default ) ; if ( $ returnVal == "date('Y-m-d')" ) { return date ( 'Y-m-d' ) ; } elseif ( $ returnVal == "date('Y-m-d H:i:s')" ) { return date ( 'Y-m-d H:i:s' ) ; } elseif ( $ returnVal == "" ) { return "" ; } else { if ( $ includetime ) { if ( self :: Get ( $ fieldname . "Hour" ) ) { $ hour = self :: Get ( $ fieldname . "Hour" , date ( "H" ) ) ; $ minute = self :: Get ( $ fieldname . "Minute" , date ( "i" ) ) ; $ ampm = self :: Get ( $ fieldname . "AMPM" , "AM" ) ; if ( $ ampm == "PM" ) { $ hour = ( $ hour * 1 ) + 12 ; } $ returnVal .= " " . $ hour . ":" . $ minute . ":" . "00" ; } return date ( "Y-m-d H:i:s" , strtotime ( $ returnVal ) ) ; } else { return date ( "Y-m-d" , strtotime ( $ returnVal ) ) ; } } }
Returns a form parameter as a date formatted for mysql YYYY-MM-DD,
expects some type of date format.  if default value is not provided,
will return today.  if default value is empty string "" will return
empty string.

@param	string $fieldname
@param	string $default default value = today
@param	bool $includetime whether to include the time in addition to date
@return   string
Returns a form parameter as a date formatted for mysql YYYY - MM - DD expects some type of date format . if default value is not provided will return today . if default value is empty string will return empty string .