How to write a db_query with condition on a datefield with enddate - value1 and value2
Fields are not stored in the node/entity table to which they relate, it would be quite inefficient to do that.

Drupal 7 introduced the new EntityFieldQuery class to help you build up these kinds of queries. I'd recommend reading the docs, but for your purposes the code would look something like this:

$query = new EntityFieldQuery;
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;entityCondition('bundle', $type)
  -&gt;propertyCondition('uid', $uid)
  -&gt;fieldCondition('field_mytime', 'value', $daystart, '&gt;')
  -&gt;fieldCondition('field_mytime', 'value2', $dayend, '&lt;');

$results = $query-&gt;execute();
if (isset($results['node'])) {
  // Load all node objects based on the results of the query
  $nids = array_keys($results['node']);
  $nodes = node_load_multiple($nids);
}