Don't format the date to include it in SQL at all.
Use a parameterized query, and then just include the value as a parameter. That way you don't have to get any formatting right at all.
You should use parameterized queries for all data - aside from formatting, it also protects you from SQL injection attacks.
Getting a date/time format which works for the particular installation of Oracle you're using right now is not the right fix. Do it properly: avoid including data in your code (the SQL).
On a different matter, your question is making incorrect assumptions to start with. A DateTime
variable doesn't hold value in a "usual format" at all, any more than an int
holds a decimal representation or a hex representation of a number. DateTime
doesn't store text internally at all - it stores a number of ticks. How it is formatted when you call ToString
depends on all kinds of cultural aspects. It's worth separating the notion of the fundamental value represented by a type from the formatted string representation you might happen to obtain by calling ToString
.