fixed date related functions for sqlite
more tests