Refactor db_helper_compare_days()

Proposed fix for https://www.mantisbt.org/bugs/view.php?id=17980

I have not fully tested this.
This is expected in seconds, hence name and comment should reflect the same.