I'm looking for the right zf2 syntax to select timestamps / timeranges from the database. I know how to make where statements. However it seems that greaterThan() and lessThan() are not working with timestamps/datetime:
where = new Where();
$where->lessThan("datecolumn",$vardate);
I want to select all records older than 2 hours. so whats the right way to select date with zend framework 2?
Thx, I really appreciate your help
This works fine (just a sample) -
$select = new Select('album');
$created = date('Y-m-d H:i:s', strtotime("-2 hours"));
$where = new Where();
$where->lessThanOrEqualTo('created', $created);
$select->where($where);
$resultSet = $this->tableGateway->selectWith($select);