Cleaning database, returning previous date