Datequery timezone fixes for bug #542

Fixes for bug #542