This appears to be a PreparedStatement of some sort. How are binding the parameters to it? Are you having any errors. The mixture of date format functions and a PreparedStatement is a bit odd. You should be able to just call setDate(1, sqlDateValue) on the PreparedStatement and it will handle the formatting for you... aka you shouldn't need the date function in your SQL.