Fixing Date Queries

Fixing the Date queries through sqlalchemy extract.