how to implement substring() in db_select statement
A couple quick greps suggest something like this...

$query-&gt;where('SUBSTRING(counter_date,1,10) = :arg', array(':arg' =&gt; $arg));


...should do it.