I have a starts_at
field that keeps a timestamp with the moment something starts. Also, I have another field seconds_long
that represents the amount of seconds that the event lasts.
I need to select all unfinished events but I just can't find a way to sum the starts_at
and seconds_long
fields. I first tried to sum them, expecting Doctrine do some magic, but it didn't work:
addWhere("c.starts_at + c.seconds_long > ?", date('Y-m-d H:i:s', time()));
Unfortunately, that does not work. Then, I tried to convert the starts_at
field to UNIX seconds, but I didn't find a SQL function that worked in sqlite and MySQL.
Is there a way to do this? How?