parse datetime in queries