ADOdb Library for PHP Manual
Prev DBDate Next

DBDate($date)

Format the $date in the format the database accepts. This is used for sending dates to the database (eg. in UPDATE, INSERT or the where clause of SELECT statements). When retrieving date columns with the SELECT statement use SQLDate. The $date parameter can be a Unix integer timestamp or an ISO format Y-m-d. Uses the fmtDate field, which holds the format to use. If null or false or '' is passed in, it will be converted to an SQL null.

Returns the date as a quoted string.

	$sql = "select * from atable where created > ".$db->DBDate("$year-$month-$day");
	$db->Execute($sql);

BindDate($date)

Format the $date in the bind format the database accepts. Normally this means that the date string is not quoted, unlike DBDate, which quotes the string.

	$sql = "select * from atable where created > ".$db->Param('0');
	// or
	$sql = "select * from atable where created > ?";
	$db->Execute($sql,array($db->BindDate("$year-$month-$day"));

Prev Home Next
Quote Up DBTimeStamp

Sponsored by phpLens