Test and fix query method
Test with datetime