It appears that by expanding the date into the query yourself, you're not getting it into a form that the underlying database will accept. Try binding the date as a parameter. In that way, perhaps [note: this means I'm speculating] the underlying binding mechanism will do the correct converion for you.