ADOdb Library for PHP Manual
Prev DBDate Next

DBTimeStamp($ts)

Format the timestamp $ts in the format the database accepts; this can be a Unix integer timestamp or an ISO format Y-m-d H:i:s. Uses the fmtTimeStamp 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 timestamp as a quoted string.

	$sql = "select * from atable where created > ".$db->DBTimeStamp("$year-$month-$day $hr:$min:$secs");
	$db->Execute($sql);

BindTimeStamp($ts)

Format the timestamp $ts in the bind format the database accepts. Normally this means that the timestamp string is not quoted, unlike DBTimeStamp, 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->BindTimeStamp("$year-$month-$day $hr:$min:$secs"));

Prev Home Next
DBDate Up UnixDate

Sponsored by phpLens